Submission #109135

# Submission time Handle Problem Language Result Execution time Memory
109135 2019-05-04T15:51:14 Z bibabas Ronald (COCI17_ronald) C++14
120 / 120
58 ms 4296 KB
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vvi vector<vi>
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair

int INF = (int)2e9;

using namespace std;

template <class T>
istream& operator >>(istream &in, vector<T> &arr) {
    for (T &cnt : arr) {
        in >> cnt;
    }
    return in;
};

int matr[1000][1000];
bool visited[1000];
int state[1000];
bool kek1 = true, kek2 = true;
int n;

void solve() {
    int m; cin >> n >> m;
    for (int j = 0; j < m; ++j){
        int v, u; cin >> v >> u;
        matr[v - 1][u - 1] = 1;
        matr[u - 1][v - 1] = 1;
    }
    for (int i = 0; i < n; ++i){
        for (int j = i + 1; j < n; ++j){
            if (matr[i][j])
                state[j] = state[i];
            else
                state[j] = state[i] ^ 1;
        }
    }
    for (int i = 0; i < n; ++i){
        for (int j = i + 1; j < n; ++j){
            if ((matr[i][j] + state[i] + state[j]) % 2 == 0){
                cout << "NE";
                return;
            }
        }
    }
    cout << "DA";
}

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
#endif

    solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 588 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 2 ms 640 KB Output is correct
3 Correct 3 ms 768 KB Output is correct
4 Correct 3 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 1196 KB Output is correct
2 Correct 16 ms 2816 KB Output is correct
3 Correct 9 ms 1664 KB Output is correct
4 Correct 6 ms 1664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1152 KB Output is correct
2 Correct 12 ms 2304 KB Output is correct
3 Correct 44 ms 4296 KB Output is correct
4 Correct 58 ms 4224 KB Output is correct