# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
715026 | keystone | Kamenčići (COCI21_kamencici) | C++14 | 1 ms | 212 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 <iostream>
#include <string>
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 (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... |