Submission #227594

# Submission time Handle Problem Language Result Execution time Memory
227594 2020-04-28T03:42:11 Z syy Ronald (COCI17_ronald) C++17
120 / 120
46 ms 4224 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int n, m, x, y;
bool a[1005][1005], b[1005][1005];

void flip(bool a[1005][1005], int x) {
	FOR(i, 1, n) {
		a[i][x] = !a[i][x];
		a[x][i] = !a[x][i];
	}
}

bool check(bool a[1005][1005]) {
	FOR(i, 2, n) if (!a[i][1]) flip(a, i);
	FOR(i, 1, n) FOR(j, i+1, n) if (!a[i][j]) return false;
	return true;
}

int main() {
	fastio; cin >> n >> m;
	FOR(i, 1, m) {
		cin >> x >> y;
		a[x][y] = a[y][x] = 1;
		b[x][y] = b[y][x] = 1;
	}
	if (check(a)) {cout << "DA"; return 0;}
	flip(b, 1);
	if (check(b)) cout  << "DA";
	else 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 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 4 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 4 ms 256 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 5 ms 436 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 512 KB Output is correct
3 Correct 5 ms 512 KB Output is correct
4 Correct 5 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 768 KB Output is correct
2 Correct 14 ms 1792 KB Output is correct
3 Correct 9 ms 1152 KB Output is correct
4 Correct 7 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 768 KB Output is correct
2 Correct 11 ms 1664 KB Output is correct
3 Correct 31 ms 3584 KB Output is correct
4 Correct 46 ms 4224 KB Output is correct