# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92093 | 2019-01-01T13:30:53 Z | Kastanda | Sajam (COCI18_sajam) | C++11 | 492 ms | 632 KB |
#include<bits/stdc++.h> using namespace std; const int N = 1003; int n, k; char S[N]; bitset < N > A[N], B[N]; int main() { scanf("%d%d", &n, &k); for (int i = 0; i < n; i++) { scanf("%s", &S); for (int j = 0; j < n; j++) A[i][j] = (S[j] == 'o'), B[i][j] = !A[i][j]; memset(S, 0, sizeof(S)); } for (int i = 0; i < n; i++) { int cnt = 0; for (int j = 0; j < n; j++) { int a = (A[i] ^ A[j]).count(); int b = (B[i] ^ A[j]).count(); int c = (A[i] ^ B[j]).count(); int d = (B[i] ^ B[j]).count(); cnt += min({a, b, c, d}); } if (cnt <= k) return !printf("DA\n"); } if (k == n) { for (int i = 0; i < n; i++) { A[0][i] = !A[0][i]; B[0][i] = !B[0][i]; int cnt = 0; for (int j = 0; j < n; j++) { int a = (A[0] ^ A[j]).count(); int b = (B[0] ^ A[j]).count(); int c = (A[0] ^ B[j]).count(); int d = (B[0] ^ B[j]).count(); cnt += min({a, b, c, d}); } if (cnt <= k) return !printf("DA\n"); A[0][i] = !A[0][i]; B[0][i] = !B[0][i]; } } return !printf("NE\n"); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 376 KB | Output is correct |
3 | Correct | 3 ms | 376 KB | Output is correct |
4 | Correct | 7 ms | 504 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 67 ms | 504 KB | Output is correct |
8 | Correct | 229 ms | 504 KB | Output is correct |
9 | Correct | 15 ms | 376 KB | Output is correct |
10 | Correct | 235 ms | 596 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 4 ms | 376 KB | Output is correct |
4 | Correct | 3 ms | 376 KB | Output is correct |
5 | Correct | 3 ms | 380 KB | Output is correct |
6 | Correct | 4 ms | 376 KB | Output is correct |
7 | Correct | 6 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 508 KB | Output is correct |
2 | Correct | 6 ms | 504 KB | Output is correct |
3 | Correct | 5 ms | 420 KB | Output is correct |
4 | Correct | 4 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 504 KB | Output is correct |
6 | Correct | 77 ms | 380 KB | Output is correct |
7 | Correct | 146 ms | 544 KB | Output is correct |
8 | Correct | 161 ms | 504 KB | Output is correct |
9 | Correct | 45 ms | 376 KB | Output is correct |
10 | Correct | 264 ms | 616 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 516 KB | Output is correct |
2 | Correct | 6 ms | 504 KB | Output is correct |
3 | Correct | 5 ms | 504 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 504 KB | Output is correct |
6 | Correct | 256 ms | 616 KB | Output is correct |
7 | Correct | 62 ms | 392 KB | Output is correct |
8 | Correct | 139 ms | 504 KB | Output is correct |
9 | Correct | 159 ms | 504 KB | Output is correct |
10 | Correct | 266 ms | 608 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 504 KB | Output is correct |
2 | Correct | 5 ms | 504 KB | Output is correct |
3 | Correct | 383 ms | 632 KB | Output is correct |
4 | Correct | 130 ms | 496 KB | Output is correct |
5 | Correct | 145 ms | 632 KB | Output is correct |
6 | Correct | 492 ms | 600 KB | Output is correct |
7 | Correct | 151 ms | 504 KB | Output is correct |
8 | Correct | 168 ms | 512 KB | Output is correct |
9 | Correct | 175 ms | 508 KB | Output is correct |
10 | Correct | 167 ms | 504 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 632 KB | Output is correct |
2 | Correct | 8 ms | 504 KB | Output is correct |
3 | Correct | 355 ms | 504 KB | Output is correct |
4 | Correct | 280 ms | 504 KB | Output is correct |
5 | Correct | 147 ms | 540 KB | Output is correct |
6 | Correct | 305 ms | 556 KB | Output is correct |
7 | Correct | 157 ms | 500 KB | Output is correct |
8 | Correct | 403 ms | 592 KB | Output is correct |
9 | Correct | 218 ms | 520 KB | Output is correct |
10 | Correct | 484 ms | 608 KB | Output is correct |