Submission #474562

#TimeUsernameProblemLanguageResultExecution timeMemory
474562blueMonochrome Points (JOI20_monochrome)C++17
25 / 100
2073 ms324 KiB
#include <iostream> #include <string> #include <deque> using namespace std; int main() { int N; string S; cin >> N; cin >> S; deque<int> white, black; for(int i = 0; i < 2*N; i++) { if(S[i] == 'W') white.push_back(i); else black.push_back(i); } long long res = 0; for(int s = 0; s < N; s++) { long long curr = 0; for(int i = 0; i < N; i++) for(int j = i+1; j < N; j++) { bool good = 0; int ia = min(black[i], white[i]), ib = max(black[i], white[i]); int ja = min(black[j], white[j]), jb = max(black[j], white[j]); if(ia < ja && ja < ib && ib < jb) curr++; else if(ja < ia && ia < jb && jb < ib) curr++; } res = max(res, curr); black.push_back(black.front()); black.pop_front(); } cout << res << '\n'; }

Compilation message (stderr)

monochrome.cpp: In function 'int main()':
monochrome.cpp:29:22: warning: unused variable 'good' [-Wunused-variable]
   29 |                 bool good = 0;
      |                      ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...