| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 474562 | blue | Monochrome Points (JOI20_monochrome) | C++17 | 2073 ms | 324 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>
#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)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
