QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#574234#9308. World CupacdwzWA 0ms3648kbC++141.2kb2024-09-18 21:10:262024-09-18 21:10:27

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 21:10:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-09-18 21:10:26]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int t,k1[35],k2[35],k3[35],k4[35],k5[35]; 
bool cmp(int a,int b){
	return a>b;
}
int main()
{
	cin>>t;
	while(t--){
		int c;
		cin>>c;
		for(int i=1;i<=31;i++){
			cin>>k1[i];
		}
		sort(k1+1,k1+1+31,cmp);
		k1[32]=c;
		sort(k1+29,k1+33,cmp);
		if(k1[29]!=c && k1[30]!=c){
			cout<<32<<'\n';
			continue;
		}
		int x=1;
		for(int i=1;i<=32;i+=8){
			k2[x++]=max(k1[i],k1[i+5]);
		}
		for(int i=1;i<=32;i+=8){
			k2[x++]=max(k1[i+1],k1[i+4]);
		}
		if(k2[x-2]!=c && k2[x-1]!=c){
			cout<<16<<'\n';
			continue;
		}
		int y=1;
		for(int i=1;i<x;i+=2){
			k3[y++]=max(k2[i],k2[i+1]);
		}
		if(k3[y-1]!=c){
			cout<<8<<'\n';
			continue;
		}
		for(int i=1;i<32;i++) cout<<k1[i]<<' ';
		cout<<'\n';
		for(int i=1;i<x;i++) cout<<k2[i]<<' ';
		cout<<'\n';
		for(int i=1;i<y;i++) cout<<k3[i]<<' ';
		cout<<'\n';
		int z=1;
		for(int i=1;i<y;i+=2){
			k4[z++]=max(k3[i],k3[i+1]);
		}
		if(k4[z-1]!=c){
			cout<<4<<'\n';
			continue;
		}
		int v=1;
		for(int i=1;i<z;i+=2){
			k5[v++]=max(k4[i],k4[i+1]);
		}
		if(k5[v-1]!=c){
			cout<<2<<'\n';
			continue;
		}
		if(k5[v-1]){
			cout<<1<<'\n';
			continue;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3648kb

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:

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 32 3 2 
31 23 15 7 30 22 14 32 
31 15 30 32 
1

result:

wrong answer 1st numbers differ - expected: '1', found: '31'