#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")
#define watch(x) cout<<(#x)<<"="<<(x)<<'\n'
#define mset(d,val) memset(d,val,sizeof(d))
#define cbug if(DEBUG) cout
#define setp(x) cout<<fixed<<setprecision(x)
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define forn(i,a,b) for(int i=(a);i<(b);i++)
#define fore(i,a,b) for(int i=(a);i<=(b);i++)
#define pb push_back
#define F first
#define S second
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
//template<typename T>
//using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void SD(int t=0){ cout<<"PASSED "<<t<<endl; }
ostream& operator<<(ostream &out, ii x){ out<<"("<<x.F<<","<<x.S<<")"; return out; }
template<typename T> void amax(T &a, T b){ a=max(a,b); }
template<typename T> void amin(T &a, T b){ a=min(a,b); }
struct Hash {
static uint64_t splitmix64(uint64_t x) {
// http://xorshift.di.unimi.it/splitmix64.c
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
return splitmix64(x + FIXED_RANDOM);
}
};
const ll INF = ll(1e18);
const int MOD = 998244353;
const bool DEBUG = 0;
const int MAXN = 1005;
const int LG = 21;
int n,m;
vector<int> adj[MAXN];
void no()
{
cout<<"NO\n";
}
int main()
{
cin.tie(0)->sync_with_stdio(0);
cin>>n>>m;
forn(i,0,m)
{
int u,v; cin>>u>>v; u--; v--;
adj[u].pb(v);
adj[v].pb(u);
}
if (m != n - 1)
{
no();
return 0;
}
// if (n == 1)
// {
// cout<<"YES\n";
// cout<<1<<'\n';
// cout<<1<<'\n';
// return 0;
// }
// int rt = -1;
// forn(i,0,n)
// {
// if (sz(adj[i]) == 1)
// {
// rt = i;
// break;
// }
// }
// assert(rt != -1);
// rt = adj[rt][0];
// if (sz(adj[rt]) != n - 1)
// {
// no();
// return 0;
// }
cout << "YES\n";
cout << 1 << '\n';
cout << 1 << '\n';
// cout << rt + 1 << ' ' << rt + 1 << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Partially correct |
1 ms |
212 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
7 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
8 |
Partially correct |
1 ms |
212 KB |
Failed to provide a successful strategy. |
9 |
Partially correct |
1 ms |
212 KB |
Failed to provide a successful strategy. |
10 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
11 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
12 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
13 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
14 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
15 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
16 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
17 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
18 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
19 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
20 |
Partially correct |
1 ms |
340 KB |
Failed to provide a successful strategy. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
3 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
4 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
5 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
6 |
Partially correct |
0 ms |
212 KB |
Failed to provide a successful strategy. |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Partially correct |
0 ms |
340 KB |
Failed to provide a successful strategy. |
9 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |