이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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';
}
컴파일 시 표준 에러 (stderr) 메시지
monochrome.cpp: In function 'int main()':
monochrome.cpp:29:22: warning: unused variable 'good' [-Wunused-variable]
29 | bool good = 0;
| ^~~~
# | 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... |