QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#706630#9557. Temperancesuperguymj#WA 1ms5832kbC++201.3kb2024-11-03 12:42:512024-11-03 12:42:53

Judging History

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

  • [2024-11-03 12:42:53]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5832kb
  • [2024-11-03 12:42:51]
  • 提交

answer

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

int T,n,cnt,x[N],y[N],z[N],num[N];
bool ggx[N],ggy[N],ggz[N];
vector<int>hx[N],hy[N],hz[N],X[N],Y[N],Z[N];

int main()
{
	cin>>T;
	while(T--)
	{
		scanf("%d",&n);
		for(int i=1;i<=n;i++)
		{
			num[i]=3;
			scanf("%d%d%d",&x[i],&y[i],&z[i]);
			hx[x[i]].push_back(i);
			hy[y[i]].push_back(i);
			hz[z[i]].push_back(i);
		}
		for(int i=1;i<=n;i++)
		{
			X[hx[x[i]].size()].push_back(x[i]);
			Y[hy[y[i]].size()].push_back(y[i]);
			Z[hz[z[i]].size()].push_back(z[i]);
		}
		cnt=0;
		for(int i=0;i<n;i++)
		{
			for(auto t:X[i])
			{
				if(ggx[t]) continue;
				ggx[t]=1;
				for(auto tt:hx[t])
				{
					num[tt]--;
					if(!num[tt]) cnt++;
				}
			}
			for(auto t:Y[i])
			{
				if(ggy[t]) continue;
				ggy[t]=1;
				for(auto tt:hy[t])
				{
					num[tt]--;
					if(!num[tt]) cnt++;
				}
			}
			for(auto t:Z[i])
			{
				if(ggz[t]) continue;
				ggz[t]=1;
				for(auto tt:hy[t])
				{
					num[tt]--;
					if(!num[tt]) cnt++;
				}
			}
			printf("%lld ",cnt);
		}
		for(int i=0;i<=n;i++)
		{
			hx[x[i]].clear();
			hy[y[i]].clear();
			hz[z[i]].clear();
			X[i].clear();
			Y[i].clear();
			Z[i].clear();
			ggx[x[i]]=0;
			ggy[y[i]]=0;
			ggz[z[i]]=0;
		}
		puts("");
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3996kb

input:

2
5
1 1 1
1 1 2
1 1 3
2 3 5
2 2 4
3
1 1 1
2 2 2
3 3 3

output:

0 0 2 5 5 
0 3 3 

result:

ok 8 numbers

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 5832kb

input:

16
1
1 1 1
2
1 1 1
1 1 100000
3
1 1 1
1 1 100000
1 100000 1
4
1 1 1
1 1 100000
1 100000 1
1 100000 100000
5
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
6
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 1 100000
7
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 ...

output:

0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 1 5 
0 0 0 0 6 6 
0 0 0 1 7 7 7 
0 0 0 0 8 8 8 8 
0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 1 5 
0 0 0 0 6 6 
0 0 0 1 7 7 7 
0 0 0 0 8 8 8 8 

result:

wrong answer 25th numbers differ - expected: '0', found: '1'