# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
715028 | 2023-03-25T20:54:02 Z | keystone | Kamenčići (COCI21_kamencici) | C++14 | 0 ms | 212 KB |
#include <iostream> #include <cstring> using namespace std; int main() { int n, k; cin >> n >> k; string pebbles; cin >> pebbles; int redCount = 0; for (char c : pebbles) { if (c == 'C') { redCount++; } } bool antunWins = true; if (redCount <= k) { antunWins = false; } else { int redRemoved = 0; int blueRemoved = 0; int i = 0; int j = n-1; while (i < j) { if (pebbles[i] == 'C') { redRemoved++; if (redRemoved == k) { antunWins = false; break; } } else { blueRemoved++; } i++; if (pebbles[j] == 'C') { redRemoved++; if (redRemoved == k) { antunWins = false; break; } } else { blueRemoved++; } j--; } if (i == j && pebbles[i] == 'C' && redRemoved < k) { antunWins = false; } } if (antunWins=(true)) { cout << "DA" << endl; } else { cout << "NE" << endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |