Submission #226517

# Submission time Handle Problem Language Result Execution time Memory
226517 2020-04-24T06:56:48 Z quocnguyen1012 Ronald (COCI17_ronald) C++14
120 / 120
56 ms 3320 KB
#include <bits/stdc++.h>

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ar array

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

const int maxn = 1005, maxr = 1005, inf = 2e9;

bool have[maxn][maxn];
int col[maxn], N, M;

signed main(void)
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #ifdef LOCAL
    freopen("A.INP", "r", stdin);
    freopen("A.OUT", "w", stdout);
  #endif // LOCAL
  cin >> N >> M;
  while(M--){
    int u, v; cin >> u >> v;
    have[u][v] = have[v][u] = true;
  }
  for(int y = 0; y < 2; ++y){
    col[1] = y;
    for(int i = 2; i <= N; ++i){
      col[i] = int(1 ^ col[1] ^ have[1][i]);
    }
    bool ok = true;
    for(int i = 1; i <= N; ++i){
      for(int j = 1;j <= N; ++j){
        if(i != j){
          if(int(col[i] ^ col[j] ^ have[i][j]) == 0)
            ok = false;
        }
      }
    }
    if(ok){
      cout << "DA";
      return 0;
    }
  }
  cout << "NE";
}

# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 512 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 640 KB Output is correct
2 Correct 15 ms 1280 KB Output is correct
3 Correct 9 ms 768 KB Output is correct
4 Correct 9 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 640 KB Output is correct
2 Correct 11 ms 1152 KB Output is correct
3 Correct 37 ms 2556 KB Output is correct
4 Correct 56 ms 3320 KB Output is correct