Submission #227679

#TimeUsernameProblemLanguageResultExecution timeMemory
227679cstuartRonald (COCI17_ronald)C++17
120 / 120
46 ms3192 KiB
#define USE_MATH_DEFINES 1 #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; #define MOD 998244353ll #define INF 1000000000000000000ll #define EPS 1e-9 #define getchar_unlocked _getchar_nolock #define putchar_unlocked _putchar_nolock typedef long long ll; typedef long double ld; typedef pair <ll,ll> pl; typedef tuple <ll,ll,ll> tl; ll N, M; bool adj[1005][1005], state[1005], yes; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N >> M; for (ll i = 1; i <= M; i++) { ll x, y; cin >> x >> y; adj[x][y] = true; adj[y][x] = true; } state[1] = 1; for (ll j = 2; j <= N; j++) { state[j] = adj[1][j]; } yes = true; for (ll i = 2; i <= N; i++) { for (ll j = 1; j <= N; j++) { if (i == j) continue; if (adj[i][j] && (state[i] != state[j])) yes = false; if (!adj[i][j] && (state[i] == state[j])) yes = false; } } cout << ((yes) ? "DA" : "NE"); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...