QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#653286 | #7755. Game on a Forest | anlanyi | WA | 2ms | 5912kb | C++20 | 602b | 2024-10-18 19:50:13 | 2024-10-18 19:50:13 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
using ll=long long ;
long long f[N];
pair<char,array<ll ,4>>w[N];
int vis[N];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin >> n >> m;
vector<vector<int >>h(n+1);
vector<int >vis(n+1);
for(int i=1;i<=m;i++){
int a,b;
cin >> a >> b;
h[a].push_back(b);
h[b].push_back(a);
vis[a]++;
vis[b]++;
}
int cnt=0;
for(int i=1;i<=n;i++){
cnt+=vis[i]==0;
}
cout<<(n+m)/2+cnt/2;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3536kb
input:
3 1 1 2
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
4 3 1 2 2 3 3 4
output:
3
result:
ok 1 number(s): "3"
Test #3:
score: -100
Wrong Answer
time: 2ms
memory: 5912kb
input:
100000 1 4647 17816
output:
99999
result:
wrong answer 1st numbers differ - expected: '1', found: '99999'