QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#220599 | #7107. Chaleur | salvator_noster# | WA | 115ms | 4272kb | C++17 | 870b | 2023-10-20 16:16:20 | 2023-10-20 16:16:20 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int M=1e6+10;
int deg[M];
int main(){
int T;
scanf("%d",&T);
while(T--){
int n,m;
scanf("%d%d",&n,&m);
for(int i=1;i<=m;++i){
int a,b;
scanf("%d%d",&a,&b);
deg[a]++,deg[b]++;
}
sort(deg+1,deg+n+1,greater<int>());
int sum=0,mx=0,mn=0;
for(int i=1;i<=n;++i){
sum+=deg[i];
if(sum-i*(i-1)==2*m-sum){
mx=i;
if(!mn)mn=i;
}
}
int ans1=1,ans2=1;
if(deg[mx]==mx-1)
for(int i=mx+1;i<=n;++i)
if(deg[i]==mx-1)ans1++;
for(int i=1;i<=mn;++i)
if(deg[i]==mn)ans2++;
printf("%d %d\n",ans1,ans2);
for(int i=1;i<=n;++i)deg[i]=0;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3912kb
input:
3 3 2 1 2 2 3 6 6 1 2 2 3 1 3 1 4 2 5 3 6 4 1 1 2
output:
2 1 1 4 1 2
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 115ms
memory: 4272kb
input:
2231 1 0 5 7 4 1 3 4 3 1 3 5 4 2 3 2 4 5 5 4 2 1 2 5 2 4 2 3 5 10 3 2 2 5 1 4 4 2 4 5 1 2 1 3 3 5 3 4 1 5 5 10 1 3 2 4 1 4 5 2 2 3 1 5 5 4 1 2 3 4 5 3 5 9 2 5 3 5 2 3 2 1 4 3 3 1 4 1 4 5 2 4 5 4 4 2 4 1 4 5 4 3 5 9 4 1 4 5 3 4 2 4 2 1 3 1 2 5 3 5 3 2 5 4 2 5 2 3 2 1 2 4 5 9 5 2 1 3 4 3 1 2 5 4 4 2 5...
output:
1 1 3 1 4 1 1 5 1 5 2 1 4 1 2 1 4 1 2 1 2 1 3 1 4 1 4 1 1 5 2 1 4 1 1 5 1 5 1 5 3 1 4 1 4 1 4 1 3 1 3 1 4 1 4 1 2 1 4 1 4 1 1 5 1 5 2 1 4 1 4 1 4 1 3 1 2 1 4 1 2 1 4 1 4 1 4 1 3 1 1 5 4 1 4 1 1 5 2 1 4 1 2 1 2 1 1 5 4 1 1 5 3 1 4 1 1 5 2 1 1 5 3 1 3 1 1 5 3 1 3 1 2 1 1 5 4 1 3 1 1 5 2 1 3 1 2 1 2 1 ...
result:
wrong answer 1013th lines differ - expected: '2 1', found: '1 1'