Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define mp make_pair
- #define pb push_back
- const int N = 101;
- int g[N][N];
- signed main()
- {
- ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
- //freopen("input.txt","r",stdin);
- //freopen("output.txt","w",stdout);
- int n,m;
- cin >> n >> m;
- int a,b;
- for(int i=0;i<m;i++)
- {
- cin >> a >> b;
- g[a][b]=1;
- g[b][a]=1;
- }
- for(int i=1;i<=n;i++)
- {
- for(int j=i+1;j<=n;j++)
- {
- for(int k=j+1;k<=n;k++)
- {
- if((g[i][j] && g[j][k] && !g[k][i])
- || (g[i][j] && !g[j][k] && g[k][i])
- || (!g[i][j] && g[j][k] && g[k][i]))
- {
- cout << "NO";
- return 0;
- }
- }
- }
- }
- cout << "YES";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement