#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5+1;
int cnt[MAXN+1];
#define pb push_back
#define sz(a) (int)(a.size())
typedef long long int ll;
typedef vector<vector<int>>vii;
vii adj(1111);
int main()
{
//the graph must be a tree
//if have cycle then bob's possible space never decreases around the cycle
//how to solve when have tree?
//think about search space of bob
//each turn a on state becomes off and turn everything incident to it on
//alice can pick a node and off it
//can she make everything off?
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
int v,u;
cin>>v>>u;
adj[v].pb(u);
adj[u].pb(v);
}
bool ok = 1;
for(int i=1;i<=n;i++){
if(sz(adj[i]) >1){
for(int x:adj[i]){
if(sz(adj[x]) > 1)ok = 0;
}
}
}
if(ok){
cout<<"YES"<<'\n';
cout<<2<<'\n';
cout<<1<<" "<<1;
}
else cout<<"NO";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
332 KB |
Provide a successful but not optimal strategy. |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
332 KB |
Provide a successful but not optimal strategy. |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Partially correct |
0 ms |
336 KB |
Failed to provide a successful strategy. |
4 |
Incorrect |
0 ms |
328 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
332 KB |
Provide a successful but not optimal strategy. |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |