QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#565407 | #9308. World Cup | taro | WA | 1ms | 3696kb | C++14 | 2.0kb | 2024-09-15 21:12:20 | 2024-09-15 21:12:20 |
Judging History
answer
#include <iostream>
#include <algorithm>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a>b?a:b)
#define COMPUTE4(a,b,c,d,e,f) {\
e = MAX(a,b);\
e = MAX(e,c);\
e = MAX(e,d);\
f = MIN(a,b);\
if (c!=e && f<c) f=c;\
if (d!=e && f<d) f=d;\
}
int a[32];
int result = 32;
int china ;
int a1,a2,
b1,b2,
c1,c2,
d1,d2,
e1,e2,
f1,f2,
g1,g2,
h1,h2,
W1,W2,W3,W4,W5,W6,W7,W8,W9,W10,W11,W12,W13,W14,W15;
void solve(int n){
if (n==32){
COMPUTE4(a[24],a[25],a[26],a[27],h1,h2);
W1= MAX(a1,b2); if (W1==china) result=8;
W2= MAX(c1,d2); if (W2==china) result=8;
W3= MAX(e1,f2); if (W3==china) result=8;
W4= MAX(g1,h2); if (W4==china) result=8;
W5= MAX(b1,a2); if (W5==china) result=8;
W6= MAX(d1,c2); if (W6==china) result=8;
W7= MAX(f1,e2); if (W7==china) result=8;
W8= MAX(h1,g2); if (W8==china) result=8;
W9= MAX(W1,W2); if (W9==china) result=4;
W10= MAX(W3,W4); if (W10==china) result=4;
W11= MAX(W5,W6); if (W11==china) result=4;
W12= MAX(W7,W8); if (W12==china) result=4;
W13= MAX(W9,W10); if (W13==china) result=2;
W14= MAX(W11,W12); if (W14==china) result=2;
W15= MAX(W13,W14); if (W15==china) result=1;
return ;
}
if (n==4){
COMPUTE4(a[0],a[1],a[2],a[3],a1,a2);
if(a1!=china && a2!=china )
return ;
result = 16;
}else if (n==8){
COMPUTE4(a[4],a[5],a[6],a[7],b1,b2);
}else if (n==12){
COMPUTE4(a[8],a[9],a[10],a[11],c1,c2);
}else if (n==16){
COMPUTE4(a[12],a[13],a[114],a[15],d1,d2);
}else if (n==20){
COMPUTE4(a[16],a[17],a[18],a[19],e1,e2);
}else if (n==24){
COMPUTE4(a[20],a[21],a[22],a[23],f1,f2);
}else if (n==28){
COMPUTE4(a[24],a[25],a[26],a[27],g1,g2);
}
solve(n+1);
}
int main(int argc, char** argv) {
int icase;
cin>>icase;
while(icase--){
for(int i=0;i<32;i++)
cin>>a[i];
china =a[0];
solve(1);
cout<<result<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
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: 3656kb
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 4 4 4 4 4 4 4 4 4 4 4 4 4 4 1 1 1 1 1
result:
wrong answer 28th numbers differ - expected: '2', found: '1'