답안 #474562

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
474562 2021-09-19T03:33:42 Z blue Monochrome Points (JOI20_monochrome) C++17
25 / 100
2000 ms 324 KB
#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

monochrome.cpp: In function 'int main()':
monochrome.cpp:29:22: warning: unused variable 'good' [-Wunused-variable]
   29 |                 bool good = 0;
      |                      ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 128 ms 276 KB Output is correct
15 Correct 112 ms 284 KB Output is correct
16 Correct 113 ms 288 KB Output is correct
17 Correct 114 ms 292 KB Output is correct
18 Correct 76 ms 204 KB Output is correct
19 Correct 87 ms 288 KB Output is correct
20 Correct 85 ms 204 KB Output is correct
21 Correct 85 ms 324 KB Output is correct
22 Correct 78 ms 204 KB Output is correct
23 Correct 28 ms 276 KB Output is correct
24 Correct 74 ms 276 KB Output is correct
25 Correct 67 ms 288 KB Output is correct
26 Correct 78 ms 276 KB Output is correct
27 Correct 88 ms 280 KB Output is correct
28 Correct 104 ms 284 KB Output is correct
29 Correct 75 ms 204 KB Output is correct
30 Correct 81 ms 204 KB Output is correct
31 Correct 111 ms 280 KB Output is correct
32 Correct 111 ms 204 KB Output is correct
33 Correct 116 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 128 ms 276 KB Output is correct
15 Correct 112 ms 284 KB Output is correct
16 Correct 113 ms 288 KB Output is correct
17 Correct 114 ms 292 KB Output is correct
18 Correct 76 ms 204 KB Output is correct
19 Correct 87 ms 288 KB Output is correct
20 Correct 85 ms 204 KB Output is correct
21 Correct 85 ms 324 KB Output is correct
22 Correct 78 ms 204 KB Output is correct
23 Correct 28 ms 276 KB Output is correct
24 Correct 74 ms 276 KB Output is correct
25 Correct 67 ms 288 KB Output is correct
26 Correct 78 ms 276 KB Output is correct
27 Correct 88 ms 280 KB Output is correct
28 Correct 104 ms 284 KB Output is correct
29 Correct 75 ms 204 KB Output is correct
30 Correct 81 ms 204 KB Output is correct
31 Correct 111 ms 280 KB Output is correct
32 Correct 111 ms 204 KB Output is correct
33 Correct 116 ms 204 KB Output is correct
34 Execution timed out 2073 ms 204 KB Time limit exceeded
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 128 ms 276 KB Output is correct
15 Correct 112 ms 284 KB Output is correct
16 Correct 113 ms 288 KB Output is correct
17 Correct 114 ms 292 KB Output is correct
18 Correct 76 ms 204 KB Output is correct
19 Correct 87 ms 288 KB Output is correct
20 Correct 85 ms 204 KB Output is correct
21 Correct 85 ms 324 KB Output is correct
22 Correct 78 ms 204 KB Output is correct
23 Correct 28 ms 276 KB Output is correct
24 Correct 74 ms 276 KB Output is correct
25 Correct 67 ms 288 KB Output is correct
26 Correct 78 ms 276 KB Output is correct
27 Correct 88 ms 280 KB Output is correct
28 Correct 104 ms 284 KB Output is correct
29 Correct 75 ms 204 KB Output is correct
30 Correct 81 ms 204 KB Output is correct
31 Correct 111 ms 280 KB Output is correct
32 Correct 111 ms 204 KB Output is correct
33 Correct 116 ms 204 KB Output is correct
34 Execution timed out 2073 ms 204 KB Time limit exceeded
35 Halted 0 ms 0 KB -