QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#566226#9308. World CupshumianWA 1ms3600kbC++231.9kb2024-09-15 23:27:102024-09-15 23:27:11

Judging History

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

  • [2024-09-15 23:27:11]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2024-09-15 23:27:10]
  • 提交

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,0),pp2(8,0);
	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 < 1;i++)
	{
		//cout<<"round:  "<<round<<endl;
		bool ok = 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) ok = 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) ok = true;
			pp4.push_back(xx);
			//cout<<xx<<endl;
		}
		pp2 = pp4;
		pp4.clear();
		if(!ok)
		{
			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();
	}
	
}

详细

Test #1:

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

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

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

result:

wrong answer 7th numbers differ - expected: '8', found: '4'