QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#568267 | #9308. World Cup | cute | WA | 1ms | 3608kb | C++14 | 1.8kb | 2024-09-16 15:48:26 | 2024-09-16 15:48:27 |
Judging History
answer
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
void solve(){
int a32[33], a16[17], aa16[17], a8[9],a4[5],a2[3],a1[2];
for(int i = 1 ; i <= 32; i++)cin >> a32[i];
int idx = 1;
vector<int> b;
for(int i = 1; i <= 32; i++){
b.push_back(a32[i]);
if(i%4 == 0){
sort(b.begin(), b.end());
aa16[idx++] = b[3];
aa16[idx++] = b[2];
//cout << b[3] << " "<<b[2]<<endl;
b.clear();
}
}
a16[1] = aa16[1];
a16[2] = aa16[4];
a16[3] = aa16[5];
a16[4] = aa16[8];
a16[5] = aa16[9];
a16[6] = aa16[12];
a16[7] = aa16[13];
a16[8] = aa16[16];
a16[9] = aa16[2];
a16[10] = aa16[3];
a16[11] = aa16[6];
a16[12] = aa16[7];
a16[13] = aa16[10];
a16[14] = aa16[11];
a16[15] = aa16[14];
a16[16] = aa16[15];
for(int i = 1, j = 1; i <= 8; i++){
a8[i] = max(a16[j], a16[j+1]);
j+=2;
//cout << a8[i] << " ";
}
// cout << endl;
for(int i = 1, j = 1; i <= 4; i++){
a4[i] = max(a8[j], a8[j+1]);
j+=2;
//cout << a4[i] << " ";
}
//cout << endl;
for(int i = 1, j = 1; i <= 2; i++){
a2[i] = max(a4[j], a4[j+1]);
j+=2;
// cout << a2[i] << " ";
}
//cout << endl;
int flag = a32[1];
a1[1] = max(a2[1], a2[2]);
//cout << a1[1] << " ";
//cout << endl;
if(a1[1] == flag){
cout << 1 <<endl;
return;
}
if(a2[1] == flag || a2[2] == flag){
cout << 2 <<endl;
return;
}
for(int i =1; i<= 4; i++){
if(flag == a4[i]){
cout << 4 <<endl;
return;
}
}
for(int i = 1; i <= 8; i++){
if(flag == a8[i]){
cout << 8 <<endl;
return;
}
}
for(int i = 1; i <= 16; i++){
if(flag == a16[i]){
cout << 16<<endl;
return;
}
}
cout << 32 <<endl;
return;
}
int main() {
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
1 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3608kb
input:
32 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 2 1 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 3 1 2 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 4 1 2 3 5 6 7 8 9 10 11 12 13 14 15 ...
output:
32 32 16 16 16 16 8 8 8 8 8 8 8 8 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 2 1
result:
wrong answer 14th numbers differ - expected: '4', found: '8'