# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
522849 |
2022-02-06T04:13:39 Z |
KoD |
Sajam (COCI18_sajam) |
C++17 |
|
127 ms |
1416 KB |
#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::pair;
using std::tuple;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N, K;
std::cin >> N >> K;
vector<std::bitset<1000>> B(N);
for (auto& x : B) {
for (int i = 0; i < N; ++i) {
char c;
std::cin >> c;
if (c == 'o') {
x.set(i);
}
}
}
const auto cost = [&](const int i, const int j) {
const int dif = (B[i] ^ B[j]).count();
return std::min(dif, N - dif);
};
for (int i = 0; i < N; ++i) {
int sum = 0;
for (int j = 0; j < N; ++j) {
sum += cost(i, j);
}
if (sum <= K) {
std::cout << "DA\n";
return 0;
}
}
for (int i = 0; i < N; ++i) {
B[0].flip(i);
int sum = 1;
for (int j = 0; j < N; ++j) {
sum += cost(0, j);
}
B[0].flip(i);
if (sum <= K) {
std::cout << "DA\n";
return 0;
}
}
std::cout << "NE\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
4 ms |
332 KB |
Output is correct |
3 |
Correct |
5 ms |
332 KB |
Output is correct |
4 |
Correct |
16 ms |
428 KB |
Output is correct |
5 |
Correct |
6 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
32 ms |
356 KB |
Output is correct |
8 |
Correct |
113 ms |
408 KB |
Output is correct |
9 |
Correct |
8 ms |
332 KB |
Output is correct |
10 |
Correct |
115 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
332 KB |
Output is correct |
2 |
Correct |
13 ms |
420 KB |
Output is correct |
3 |
Correct |
9 ms |
332 KB |
Output is correct |
4 |
Correct |
8 ms |
332 KB |
Output is correct |
5 |
Correct |
15 ms |
428 KB |
Output is correct |
6 |
Correct |
38 ms |
332 KB |
Output is correct |
7 |
Correct |
74 ms |
332 KB |
Output is correct |
8 |
Correct |
78 ms |
388 KB |
Output is correct |
9 |
Correct |
21 ms |
332 KB |
Output is correct |
10 |
Correct |
127 ms |
424 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
332 KB |
Output is correct |
2 |
Correct |
13 ms |
420 KB |
Output is correct |
3 |
Correct |
8 ms |
396 KB |
Output is correct |
4 |
Correct |
12 ms |
404 KB |
Output is correct |
5 |
Correct |
11 ms |
332 KB |
Output is correct |
6 |
Correct |
123 ms |
412 KB |
Output is correct |
7 |
Correct |
30 ms |
332 KB |
Output is correct |
8 |
Correct |
67 ms |
332 KB |
Output is correct |
9 |
Correct |
75 ms |
332 KB |
Output is correct |
10 |
Correct |
127 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
392 KB |
Output is correct |
2 |
Correct |
8 ms |
332 KB |
Output is correct |
3 |
Correct |
99 ms |
332 KB |
Output is correct |
4 |
Correct |
33 ms |
600 KB |
Output is correct |
5 |
Correct |
39 ms |
700 KB |
Output is correct |
6 |
Correct |
126 ms |
1416 KB |
Output is correct |
7 |
Correct |
37 ms |
572 KB |
Output is correct |
8 |
Correct |
48 ms |
572 KB |
Output is correct |
9 |
Correct |
52 ms |
692 KB |
Output is correct |
10 |
Correct |
43 ms |
712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
332 KB |
Output is correct |
2 |
Correct |
18 ms |
332 KB |
Output is correct |
3 |
Correct |
92 ms |
332 KB |
Output is correct |
4 |
Correct |
69 ms |
828 KB |
Output is correct |
5 |
Correct |
45 ms |
836 KB |
Output is correct |
6 |
Correct |
81 ms |
1068 KB |
Output is correct |
7 |
Correct |
38 ms |
652 KB |
Output is correct |
8 |
Correct |
99 ms |
1220 KB |
Output is correct |
9 |
Correct |
54 ms |
776 KB |
Output is correct |
10 |
Correct |
119 ms |
1312 KB |
Output is correct |