Submission #715026

#TimeUsernameProblemLanguageResultExecution timeMemory
715026keystoneKamenčići (COCI21_kamencici)C++14
0 / 70
1 ms212 KiB
#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)

Main.cpp: In function 'int main()':
Main.cpp:56:18: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   56 |     if (antunWins=true) {
      |         ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...