# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
237390 | marlicu | Ronald (COCI17_ronald) | C++14 | 45 ms | 4216 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3 + 5;
int n;
bool linija[MAXN][MAXN];
bool kopija[MAXN][MAXN];
void promjena (int x) {
for (int i = 0; i < n; i++) {
if (i == x) continue;
kopija[i][x] = kopija[x][i] = 1 - kopija[i][x];
}
}
bool ok(int pocetno) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
kopija[i][j] = linija[i][j];
}
}
if (pocetno) promjena(0);
for (int i = 1; i < n; i++) {
if (!kopija[0][i]) promjena(i);
}
int koliko;
for (int i = 0; i < n; i++) {
koliko = 0;
for (int j = 0; j < n; j++) {
if (kopija[i][j] || i == j) koliko++;
}
if (koliko != n) return false;
}
return true;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin >> n;
int m, a, b;
cin >> m;
for (int i = 0; i < m; i++) {
cin >> a >> b;
a--; b--;
linija[a][b]++;
linija[b][a]++;
}
if (ok(0) || ok(1)) cout << "DA\n";
else cout << "NE\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |