QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#754217#9557. Temperanceucup-team3586#WA 1ms5924kbC++232.3kb2024-11-16 14:31:412024-11-16 14:31:43

Judging History

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

  • [2024-11-16 14:31:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5924kb
  • [2024-11-16 14:31:41]
  • 提交

answer

//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
int x[100100],y[100100],z[100100];
int cntx[100100],cnty[100100],cntz[100100];
vector<int> Gx[100100],Gy[100100],Gz[100100];
int marked[100100];
int ans[100100];
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--)
	{
		int n;
		cin>>n;
		for(int i=1;i<=n;i++)
		{
			marked[i]=0;
			cin>>x[i]>>y[i]>>z[i];
			Gx[x[i]].clear();
			Gy[y[i]].clear();
			Gz[z[i]].clear();
			cntx[x[i]]=cnty[y[i]]=cntz[z[i]]=0;
		}
		for(int i=1;i<=n;i++)
		{
			Gx[x[i]].pb(i);
			Gy[y[i]].pb(i);
			Gz[z[i]].pb(i);
			cntx[x[i]]++;
			cnty[y[i]]++;
			cntz[z[i]]++;
		}
		vector<array<int,3>> vec;
		for(int i=1;i<=n;i++)
		{
			if(cntx[x[i]])
			{
				vec.push_back({cntx[x[i]],x[i],0});
				cntx[x[i]]=0;
			}
			if(cnty[y[i]])
			{
				vec.push_back({cnty[y[i]],y[i],0});
				cnty[y[i]]=0;
			}
			if(cntz[z[i]])
			{
				vec.push_back({cntz[z[i]],z[i],0});
				cntz[z[i]]=0;
			}
		}
		rsrt(vec);
		int p=0,cnt=0;
		for(int k=n;k;k--)
		{
			while(p<sz(vec)&&vec[p][0]>=k)
			{
				if(vec[p][2]==0)
				{
					for(auto ind:Gx[vec[p][1]])
					{
						if(!marked[ind])
						{
							marked[ind]=1;
							cnt++;
						}
					}
				}
				if(vec[p][2]==1)
				{
					for(auto ind:Gy[vec[p][1]])
					{
						if(!marked[ind])
						{
							marked[ind]=1;
							cnt++;
						}
					}
				}
				if(vec[p][2]==2)
				{
					for(auto ind:Gz[vec[p][1]])
					{
						if(!marked[ind])
						{
							marked[ind]=1;
							cnt++;
						}
					}
				}
				p++;
			}
			ans[k]=cnt;
		}
		for(int i=1;i<=n;i++)
			cout<<n-ans[i]<<" ";
		cout<<'\n';
	}
	return 0;
}

详细

Test #1:

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

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: 0ms
memory: 5668kb

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 1 1 5 
0 0 0 2 6 6 
0 0 0 3 7 7 7 
0 0 0 0 8 8 8 8 
0 
0 0 
0 0 0 
0 0 0 0 
0 0 1 1 5 
0 0 0 2 6 6 
0 0 0 3 7 7 7 
0 0 0 0 8 8 8 8 

result:

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