QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#565655#9308. World CupshumianWA 1ms3664kbC++201.9kb2024-09-15 21:57:552024-09-15 21:57:56

Judging History

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

  • [2024-09-15 21:57:56]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3664kb
  • [2024-09-15 21:57:55]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef long long LL;


void solve()
{
	vector<vector<int>> q,q2,q3;
	int mark;
	for(int i = 0;i < 8;i ++)
	{
		vector<int> num;
		for(int j = 0;j < 4;j ++)
		{
			int x;
			cin>>x;
			if(i == 0&&j == 0) mark = x;
			num.push_back(x);	
		}
		sort(num.rbegin(),num.rend());
		q.push_back(num);
	}
	int len = q.size();
	for(int i = 0;i < len ;i++)//32->16;
	{
		while(q[i].size()>2) q[i].pop_back();
	}
	vector<int> qq;
	bool flag = false;
	for(int i = 0;i <q.size();i ++)
	{
		for(int j = 0;j < q[i].size();j ++)
		{
			qq.push_back(q[i][j]);
			if(q[i][j] == mark) flag = true;
			//cout<<q[i][j]<<endl;
		}
	}
	if(!flag)
	{
		cout<<32<<endl;
		return;
	}
	vector<int> pp1(8),pp2(8);
	pp1 = {qq[0],qq[3],qq[4],qq[7],qq[8],qq[11],qq[12],qq[15]};
	pp2 = {qq[1],qq[2],qq[5],qq[6],qq[9],qq[10],qq[13],qq[14]};
	int round = 16;
	for(int i = 0;i < 2;i++)
	{
		//cout<<"round:  "<<round<<endl;
		bool flag = false;
		vector<int> pp3,pp4;
		for(int j = 0;j < pp1.size();j += 2)
		{
			int xx = max(pp1[j],pp1[j + 1]);
			if(xx ==mark) flag = true;
			pp3.push_back(xx);
			//cout<<xx<<endl;
		}
		//cout<<endl;
		pp1 = pp3;
		pp3.clear();
		for(int j = 0;j < pp2.size();j +=2)
		{
			int xx = max(pp2[j],pp2[j + 1]);
			if(xx == mark) flag = true;
			pp4.push_back(xx);
			//cout<<xx<<endl;
		}
		pp2 = pp4;
		pp4.clear();
		if(!flag)
		{
			//cout<<round<<endl;
			return ;
		}
		round /= 2;
		//cout<<endl<<endl;
	}
	int nn1 = pp1[0],nn2 = pp1[1],nn3 = pp2[0],nn4 = pp2[1];

	nn1 = max(nn1,nn2),nn3 = max(nn3,nn4);
	
	if(nn1 != mark && nn3 != mark) 
	{
		cout<<4<<endl;
		return;
	}
	nn1 = max(nn1,nn3);
	if(nn1 == mark)
	{
		cout<<1<<endl;
	}else
	{
		cout<<2<<endl;
	}
	
	
}

signed main()
{
	int n;
	cin>>n;
	for(int i = 0;i < n;i ++)
	{
		solve();
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3640kb

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: 3664kb

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
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
2
1

result:

wrong answer 3rd numbers differ - expected: '16', found: '4'