QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#706630 | #9557. Temperance | superguymj# | WA | 1ms | 5832kb | C++20 | 1.3kb | 2024-11-03 12:42:51 | 2024-11-03 12:42:53 |
Judging History
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("");
}
}
詳細信息
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'