QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#571909 | #9308. World Cup | hardtiger | WA | 1ms | 3696kb | C++14 | 803b | 2024-09-18 10:13:58 | 2024-09-18 10:13:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 40;
int a[N];
bool cmd(int x,int y){
return x > y;
}
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int t;
cin >> t;
int num[40];
num[1] = 1;
for(int i = 2;i <= 5; ++i){
num[i] = 2;
}
for(int i = 6;i <= 19; ++i){
num[i] = 4;
}
for(int i = 20;i <= 27; ++i){
num[i] = 8;
}
for(int i = 28;i <= 30; ++i){
num[i] = 16;
}
num[31] = num[32] = 32;
while(t--){
for(int i = 1;i <= 32; ++i){
cin >> a[i];
}
int x = a[1];
int ans = 0;
sort(a + 1,a + 33,cmd);
for(int i = 1;i <=32; ++i){
if(a[i] == x){
for(int j = 1;j <= 32;j *= 2){
if(i <= j){
ans = num[j];
break;
}
}
break;
}
}
cout << ans << '\n';
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3616kb
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: 0ms
memory: 3696kb
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 32 32 32 32 32 32 32 32 32 32 32 32 32 32 4 4 4 4 4 4 4 4 4 4 4 4 2 2 2 1
result:
wrong answer 3rd numbers differ - expected: '16', found: '32'