답안 #628394

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
628394 2022-08-13T11:23:51 Z MohamedFaresNebili Monochrome Points (JOI20_monochrome) C++14
25 / 100
2000 ms 356 KB
#include <bits/stdc++.h>

            using namespace std;

            using ll = long long;
            using ld = long double;
            using pi = pair<pair<int, int>, pair<int, int>>;

            #define ff first
            #define ss second
            #define pb push_back
            #define all(x) (x).begin(), (x).end()
            #define lb lower_bound
            #define int ll

            int N; string S;
            vector<int> A, B;

            int32_t main() {
                ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
                cin >> N >> S; int res = 0;
                for(int l = 0; l < 2 * N; l++) {
                    if(S[l] == 'B') A.push_back(l);
                    if(S[l] == 'W') B.push_back(l);
                }
                for(int l = 0; l < N; l++) {
                    vector<pair<int, int>> P;
                    for(int i = 0; i < N; i++)
                        P.push_back({min(A[i], B[(i + l) % N]), max(A[i], B[(i + l) % N])});
                    int ans = 0;
                    for(int i = 0; i < N; i++) {
                        for(int j = i + 1; j < N; j++) {
                            int U = P[i].first, V = P[i].second;
                            int X = P[j].first, Y = P[j].second;
                            if(V < X) continue;
                            if(Y < U) continue;
                            if(U > X && V < Y) continue;
                            if(X > U && Y < V) continue;
                            ans++;
                        }
                    }
                    res = max(res, ans);
                }
                cout << res << "\n";
                return 0;
            }

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 18 ms 340 KB Output is correct
15 Correct 18 ms 340 KB Output is correct
16 Correct 17 ms 356 KB Output is correct
17 Correct 18 ms 324 KB Output is correct
18 Correct 12 ms 340 KB Output is correct
19 Correct 14 ms 324 KB Output is correct
20 Correct 14 ms 340 KB Output is correct
21 Correct 15 ms 340 KB Output is correct
22 Correct 14 ms 324 KB Output is correct
23 Correct 6 ms 216 KB Output is correct
24 Correct 16 ms 348 KB Output is correct
25 Correct 10 ms 340 KB Output is correct
26 Correct 21 ms 348 KB Output is correct
27 Correct 16 ms 344 KB Output is correct
28 Correct 29 ms 328 KB Output is correct
29 Correct 12 ms 344 KB Output is correct
30 Correct 11 ms 324 KB Output is correct
31 Correct 19 ms 340 KB Output is correct
32 Correct 26 ms 324 KB Output is correct
33 Correct 17 ms 352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 18 ms 340 KB Output is correct
15 Correct 18 ms 340 KB Output is correct
16 Correct 17 ms 356 KB Output is correct
17 Correct 18 ms 324 KB Output is correct
18 Correct 12 ms 340 KB Output is correct
19 Correct 14 ms 324 KB Output is correct
20 Correct 14 ms 340 KB Output is correct
21 Correct 15 ms 340 KB Output is correct
22 Correct 14 ms 324 KB Output is correct
23 Correct 6 ms 216 KB Output is correct
24 Correct 16 ms 348 KB Output is correct
25 Correct 10 ms 340 KB Output is correct
26 Correct 21 ms 348 KB Output is correct
27 Correct 16 ms 344 KB Output is correct
28 Correct 29 ms 328 KB Output is correct
29 Correct 12 ms 344 KB Output is correct
30 Correct 11 ms 324 KB Output is correct
31 Correct 19 ms 340 KB Output is correct
32 Correct 26 ms 324 KB Output is correct
33 Correct 17 ms 352 KB Output is correct
34 Execution timed out 2023 ms 340 KB Time limit exceeded
35 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 18 ms 340 KB Output is correct
15 Correct 18 ms 340 KB Output is correct
16 Correct 17 ms 356 KB Output is correct
17 Correct 18 ms 324 KB Output is correct
18 Correct 12 ms 340 KB Output is correct
19 Correct 14 ms 324 KB Output is correct
20 Correct 14 ms 340 KB Output is correct
21 Correct 15 ms 340 KB Output is correct
22 Correct 14 ms 324 KB Output is correct
23 Correct 6 ms 216 KB Output is correct
24 Correct 16 ms 348 KB Output is correct
25 Correct 10 ms 340 KB Output is correct
26 Correct 21 ms 348 KB Output is correct
27 Correct 16 ms 344 KB Output is correct
28 Correct 29 ms 328 KB Output is correct
29 Correct 12 ms 344 KB Output is correct
30 Correct 11 ms 324 KB Output is correct
31 Correct 19 ms 340 KB Output is correct
32 Correct 26 ms 324 KB Output is correct
33 Correct 17 ms 352 KB Output is correct
34 Execution timed out 2023 ms 340 KB Time limit exceeded
35 Halted 0 ms 0 KB -