QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#568258 | #9308. World Cup | cute | WA | 0ms | 3564kb | C++14 | 1.8kb | 2024-09-16 15:46:48 | 2024-09-16 15:46:49 |
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;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3564kb
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:
32 24 16 8 31 23 15 7 32 16 31 15 32 31 32 1
result:
wrong answer 1st numbers differ - expected: '1', found: '32'