Submission #1114528

# Submission time Handle Problem Language Result Execution time Memory
1114528 2024-11-19T07:07:08 Z vjudge1 Newspapers (CEOI21_newspapers) C++17
0 / 100
1 ms 512 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
using pii=pair<int,int>;

signed main(){
  int n,m;
  cin>>n>>m;
  if(n==1){
    cout<<"YES\n1\n1";
    return 0;
  }
  vector<int>v[n+1];
  for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    v[x].pb(y);
    v[y].pb(x);
  }
  int guy=0;
  for(int i=1;i<=n;i++){
    if(v[i].size()>1){
      if(guy){
        cout<<"NO\n";
        return 0;
      }
      guy=i;
    }
  }
  cout<<"YES\n2\n"<<guy<<' '<<guy;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 504 KB Integer 0 violates the range [1, 2]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 512 KB Output is correct
2 Incorrect 1 ms 336 KB Integer 0 violates the range [1, 2]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Incorrect 1 ms 504 KB Integer 0 violates the range [1, 2]
3 Halted 0 ms 0 KB -