# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
516558 | 2022-01-21T13:15:35 Z | leinad2 | Monochrome Points (JOI20_monochrome) | C++17 | 2000 ms | 332 KB |
#include<bits/stdc++.h> using namespace std; int n, i, j, k, a, b, ans; char S[400010]; vector<int>A, B; main() { scanf("%d", &n); scanf("%s", &S); for(i=0;i<2*n;i++) { if(S[i]=='B')A.push_back(i+1); else B.push_back(i+1); } for(i=0;i<n;i++) { vector<pair<int, int> >V; for(j=i;j<n;j++)V.push_back({A[j-i], B[j]}); for(j=0;j<i;j++)V.push_back({A[j+n-i], B[j]}); for(auto &p:V)if(p.first>p.second)swap(p.first, p.second); int res=0; for(j=0;j<V.size();j++)for(k=j+1;k<V.size();k++) { if((V[j].first<V[k].first&&V[k].first<V[j].second&&V[j].second<V[k].second)||(V[k].first<V[j].first&&V[j].first<V[k].second&&V[k].second<V[j].second))res++; } ans=max(ans, res); } cout<<ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 296 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 300 KB | Output is correct |
8 | Correct | 0 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 | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 296 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 296 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 300 KB | Output is correct |
8 | Correct | 0 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 | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 296 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 15 ms | 204 KB | Output is correct |
15 | Correct | 15 ms | 316 KB | Output is correct |
16 | Correct | 14 ms | 316 KB | Output is correct |
17 | Correct | 14 ms | 316 KB | Output is correct |
18 | Correct | 10 ms | 204 KB | Output is correct |
19 | Correct | 12 ms | 304 KB | Output is correct |
20 | Correct | 12 ms | 312 KB | Output is correct |
21 | Correct | 12 ms | 312 KB | Output is correct |
22 | Correct | 11 ms | 204 KB | Output is correct |
23 | Correct | 4 ms | 204 KB | Output is correct |
24 | Correct | 10 ms | 312 KB | Output is correct |
25 | Correct | 14 ms | 308 KB | Output is correct |
26 | Correct | 12 ms | 296 KB | Output is correct |
27 | Correct | 13 ms | 308 KB | Output is correct |
28 | Correct | 15 ms | 316 KB | Output is correct |
29 | Correct | 11 ms | 204 KB | Output is correct |
30 | Correct | 11 ms | 320 KB | Output is correct |
31 | Correct | 18 ms | 332 KB | Output is correct |
32 | Correct | 17 ms | 312 KB | Output is correct |
33 | Correct | 16 ms | 316 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 296 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 300 KB | Output is correct |
8 | Correct | 0 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 | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 296 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 15 ms | 204 KB | Output is correct |
15 | Correct | 15 ms | 316 KB | Output is correct |
16 | Correct | 14 ms | 316 KB | Output is correct |
17 | Correct | 14 ms | 316 KB | Output is correct |
18 | Correct | 10 ms | 204 KB | Output is correct |
19 | Correct | 12 ms | 304 KB | Output is correct |
20 | Correct | 12 ms | 312 KB | Output is correct |
21 | Correct | 12 ms | 312 KB | Output is correct |
22 | Correct | 11 ms | 204 KB | Output is correct |
23 | Correct | 4 ms | 204 KB | Output is correct |
24 | Correct | 10 ms | 312 KB | Output is correct |
25 | Correct | 14 ms | 308 KB | Output is correct |
26 | Correct | 12 ms | 296 KB | Output is correct |
27 | Correct | 13 ms | 308 KB | Output is correct |
28 | Correct | 15 ms | 316 KB | Output is correct |
29 | Correct | 11 ms | 204 KB | Output is correct |
30 | Correct | 11 ms | 320 KB | Output is correct |
31 | Correct | 18 ms | 332 KB | Output is correct |
32 | Correct | 17 ms | 312 KB | Output is correct |
33 | Correct | 16 ms | 316 KB | Output is correct |
34 | Execution timed out | 2070 ms | 332 KB | Time limit exceeded |
35 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 296 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 300 KB | Output is correct |
8 | Correct | 0 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 | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 296 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 15 ms | 204 KB | Output is correct |
15 | Correct | 15 ms | 316 KB | Output is correct |
16 | Correct | 14 ms | 316 KB | Output is correct |
17 | Correct | 14 ms | 316 KB | Output is correct |
18 | Correct | 10 ms | 204 KB | Output is correct |
19 | Correct | 12 ms | 304 KB | Output is correct |
20 | Correct | 12 ms | 312 KB | Output is correct |
21 | Correct | 12 ms | 312 KB | Output is correct |
22 | Correct | 11 ms | 204 KB | Output is correct |
23 | Correct | 4 ms | 204 KB | Output is correct |
24 | Correct | 10 ms | 312 KB | Output is correct |
25 | Correct | 14 ms | 308 KB | Output is correct |
26 | Correct | 12 ms | 296 KB | Output is correct |
27 | Correct | 13 ms | 308 KB | Output is correct |
28 | Correct | 15 ms | 316 KB | Output is correct |
29 | Correct | 11 ms | 204 KB | Output is correct |
30 | Correct | 11 ms | 320 KB | Output is correct |
31 | Correct | 18 ms | 332 KB | Output is correct |
32 | Correct | 17 ms | 312 KB | Output is correct |
33 | Correct | 16 ms | 316 KB | Output is correct |
34 | Execution timed out | 2070 ms | 332 KB | Time limit exceeded |
35 | Halted | 0 ms | 0 KB | - |