QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#367095#3506. Team Contestflying#0 1ms3600kbC++141.2kb2024-03-25 17:57:012024-07-04 03:31:21

Judging History

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

  • [2024-07-04 03:31:21]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3600kb
  • [2024-03-25 17:57:01]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N=8005;

bool del[N], have[25][25][25];
int x[N],y[N],z[N];

int main()
{
	int n;
	cin >> n;
	if(n>4000)
	{
		for(int i=1;i<=n;i++)
		{
			scanf("%d %d %d",&x[i],&y[i],&z[i]);
			have[x[i]][y[i]][z[i]]=true;
		}

		n=0;
		for(int i=1;i<=20;i++)
			for(int j=1;j<=20;j++)
				for(int k=1;k<=20;k++)
					if(have[i][j][k])
					{
						n++;
						x[n]=i, y[n]=j, z[n]=k;
					}
	}

	while(1)
	{
		int Maxx=0,Maxy=0,Maxz=0;
		for(int j=1;j<=n;j++)
		{
			if(!del[j])
			{
				Maxx=max(Maxx,x[j]);
				Maxy=max(Maxy,y[j]);
				Maxz=max(Maxz,z[j]);
			}
		}

		bool havedel=false;
		for(int j=1;j<=n;j++)
			if(!del[j] && (x[j]==Maxx)+(y[j]==Maxy)+(z[j]==Maxz)>=2)
			{
				del[j]=true;
				havedel=true;
			}

		if(!havedel)
			break;
	}

	int cnt=0;
	for(int i=1;i<=n;i++)
		if(!del[i])
			cnt++;

	if(cnt<=2)
	{
		printf("-1\n");
		return 0;
	}

	int Maxx=0, Maxy=0, Maxz=0;
	for(int i=1;i<=n;i++)
	{
		if(!del[i])
		{
			Maxx=max(Maxx,x[i]);
			Maxy=max(Maxy,y[i]);
			Maxz=max(Maxz,z[i]);
		}
	}
	printf("%lld\n",(long long)Maxx+(long long)Maxy+(long long)Maxz);
	return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3600kb

input:

3
1 1 2
1 2 1
2 1 1

output:

-1

result:

wrong answer 1st lines differ - expected: '6', found: '-1'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Runtime Error

Test #36:

score: 0
Runtime Error

input:

150000
3 3 1
2 5 5
1 3 5
4 3 5
3 4 4
4 4 2
4 3 5
5 1 2
5 4 1
2 3 3
4 4 5
3 3 5
2 4 3
1 3 2
5 2 4
4 5 3
2 5 1
5 4 3
3 2 5
1 1 4
3 2 5
2 3 5
3 3 4
1 3 4
2 4 3
1 5 4
2 1 4
1 4 4
5 4 3
4 5 3
2 1 2
5 4 5
4 5 4
5 1 2
1 4 1
3 1 4
2 5 2
3 5 3
3 4 2
5 1 4
5 2 1
1 2 2
1 3 2
5 4 3
5 4 5
3 2 4
5 5 2
5 3 3
3 4 4...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%