-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmask.cpp
More file actions
78 lines (76 loc) · 1.43 KB
/
mask.cpp
File metadata and controls
78 lines (76 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int> number;
number.push_back(-1);
int n;
cin >> n;
int m1,m2,m3,m4,w1,w2,w3,w4,i;
m1 = m2 = m3 = m4 = -1;
for (i = 1;i<(4*n)+1;i++){
int k;
cin >> k;
number.push_back(k);
if (i <= n) {
if (k > m1) {
m1 = k;
w1 = i;
}
}
else if (i<=2*n){
if (k > m2) {
m2 = k;
w2 = i;
}
}
else if (i<=3*n){
if (k>m3){
m3 = k;
w3 = i;
}
}
else{
if (k>m4){
m4 = k;
w4 = i;
}
}
}
//จะมี m1 m2 m3 m4 และ w1 w2 w3 w4 อยู่
// w1 vs w2 and w3 vs w4
int result[4],t1,t2,l1,l2;
if (m1>m2){
result[2] = w2;
t1 = w1;
l1 = m1;
}
else {
result[2] = w1;
t1 = w2;
l1 = m2;
}
if (m3>m4){
result[3] = w4;
t2 = w3;
l2 = m3;
}
else {
result[3] = w3;
t2 = w4;
l2 = m4;
}
// รอบชิง
if (l1>l2){
result[0] = t1;
result[1] = t2;
}
else{
result[0] = t2;
result[1] = t1;
}
for (i=0;i<4;i++){
cout << result[i] << " ";
}
cout << "\n";
}