QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#652920#7755. Game on a ForestanlanyiWA 0ms5960kbC++20661b2024-10-18 19:18:512024-10-18 19:18:53

Judging History

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

  • [2024-10-18 19:18:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5960kb
  • [2024-10-18 19:18:51]
  • 提交

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;
    int a=0;
    for(int i=1;i<=n;i++){
        if(vis[i]==0)a++;
        cnt+=vis[i]==1;
    }
    
    cout<<min(cnt,m)+1+a/2<<'\n';



    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

3 1
1 2

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

4 3
1 2
2 3
3 4

output:

3

result:

ok 1 number(s): "3"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 5960kb

input:

100000 1
4647 17816

output:

50001

result:

wrong answer 1st numbers differ - expected: '1', found: '50001'