QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#853562 | #9771. Guessing Game | Grain_Depot08 | WA | 69ms | 22660kb | C++14 | 730b | 2025-01-11 17:34:36 | 2025-01-11 17:34:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define N 100005
set<int>s[N],t[N];
int n,a,b,A,B;
void addb(int b,int a){
if(t[b].empty()){
t[b].insert(a);++B;
}else if(t[b].size()==1){
t[b].insert(a);
if(t[b].size()==2)--B;
}
}
void adda(int a,int b){
if(s[a].empty()){
s[a].insert(b);++A;
}else if(s[a].size()==1){
s[a].insert(b);
if(s[a].size()==2){
--A;
for(auto v:s[a])addb(v,a);
}
}else addb(b,a);
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;++i){
scanf("%d%d",&a,&b);
adda(a,b);
printf("%d %d\n",A,B);
}
return 0;
}
/*
4
1 1
1 2
2 1
2 2
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 13300kb
input:
4 1 1 1 2 2 1 2 2
output:
1 0 0 2 1 2 0 0
result:
ok 8 numbers
Test #2:
score: -100
Wrong Answer
time: 69ms
memory: 22660kb
input:
250000 49324 49323 44443 44445 92513 92513 69591 69591 52085 52082 95024 95025 21004 21005 34373 34371 60771 60772 17131 17134 34885 34882 6011 6015 56103 56105 21055 21054 71592 71593 14894 14895 25774 25771 96225 96224 16444 16442 48432 48432 86954 86952 7202 7202 38661 38665 20063 20063 85383 853...
output:
1 0 2 0 3 0 4 0 5 0 6 0 7 0 8 0 9 0 10 0 11 0 12 0 13 0 14 0 15 0 16 0 17 0 18 0 19 0 20 0 21 0 22 0 23 0 24 0 25 0 26 0 27 0 28 0 29 0 30 0 31 0 32 0 33 0 34 0 35 0 36 0 37 0 38 0 39 0 40 0 41 0 42 0 43 0 44 0 45 0 46 0 47 0 48 0 49 0 50 0 51 0 52 0 53 0 54 0 55 0 56 0 57 0 58 0 59 0 60 0 61 0 62 0...
result:
wrong answer 14059th numbers differ - expected: '6303', found: '6301'