Submission #569317

# Submission time Handle Problem Language Result Execution time Memory
569317 2022-05-27T09:55:35 Z OttoTheDino Monochrome Points (JOI20_monochrome) C++17
25 / 100
2000 ms 340 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,e)                  for (int i = s; i <= e; ++i)
#define rrep(i,s,e)                 for (int i = s; i >= e; --i)
#define pb                          push_back
#define pf                          push_front
#define fi                          first
#define se                          second
#define all(a)                      a.begin(), a.end()
#define len(a)                      (int)a.size()
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;
    string s; cin >> s;
    vi v[2];
    rep (i,0,2*n-1) v[s[i]=='B'].pb(i);

    ll ans = 0;
    rep (k,0,n-1) {
        ll cur = 0;
        rep (i,0,n-1) {
            rep (j,i+1,n-1) {
                int x1 = min(v[0][i], v[1][(i+k)%n]);
                int y1 = max(v[0][i], v[1][(i+k)%n]);
                int x2 = min(v[0][j], v[1][(j+k)%n]);
                int y2 = max(v[0][j], v[1][(j+k)%n]);
                if (x1<y2 && x1>x2 && y1>y2) ++cur;
                if (y1<y2 && y1>x2 && x1<x2) ++cur;
            }
        }
        ans = max(ans, cur);
    }

    cout << ans << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 73 ms 340 KB Output is correct
15 Correct 74 ms 316 KB Output is correct
16 Correct 68 ms 212 KB Output is correct
17 Correct 71 ms 304 KB Output is correct
18 Correct 49 ms 212 KB Output is correct
19 Correct 53 ms 212 KB Output is correct
20 Correct 53 ms 212 KB Output is correct
21 Correct 45 ms 304 KB Output is correct
22 Correct 48 ms 304 KB Output is correct
23 Correct 17 ms 324 KB Output is correct
24 Correct 45 ms 212 KB Output is correct
25 Correct 39 ms 308 KB Output is correct
26 Correct 48 ms 312 KB Output is correct
27 Correct 52 ms 304 KB Output is correct
28 Correct 64 ms 212 KB Output is correct
29 Correct 46 ms 304 KB Output is correct
30 Correct 46 ms 212 KB Output is correct
31 Correct 65 ms 212 KB Output is correct
32 Correct 66 ms 304 KB Output is correct
33 Correct 68 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 73 ms 340 KB Output is correct
15 Correct 74 ms 316 KB Output is correct
16 Correct 68 ms 212 KB Output is correct
17 Correct 71 ms 304 KB Output is correct
18 Correct 49 ms 212 KB Output is correct
19 Correct 53 ms 212 KB Output is correct
20 Correct 53 ms 212 KB Output is correct
21 Correct 45 ms 304 KB Output is correct
22 Correct 48 ms 304 KB Output is correct
23 Correct 17 ms 324 KB Output is correct
24 Correct 45 ms 212 KB Output is correct
25 Correct 39 ms 308 KB Output is correct
26 Correct 48 ms 312 KB Output is correct
27 Correct 52 ms 304 KB Output is correct
28 Correct 64 ms 212 KB Output is correct
29 Correct 46 ms 304 KB Output is correct
30 Correct 46 ms 212 KB Output is correct
31 Correct 65 ms 212 KB Output is correct
32 Correct 66 ms 304 KB Output is correct
33 Correct 68 ms 308 KB Output is correct
34 Execution timed out 2081 ms 340 KB Time limit exceeded
35 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 73 ms 340 KB Output is correct
15 Correct 74 ms 316 KB Output is correct
16 Correct 68 ms 212 KB Output is correct
17 Correct 71 ms 304 KB Output is correct
18 Correct 49 ms 212 KB Output is correct
19 Correct 53 ms 212 KB Output is correct
20 Correct 53 ms 212 KB Output is correct
21 Correct 45 ms 304 KB Output is correct
22 Correct 48 ms 304 KB Output is correct
23 Correct 17 ms 324 KB Output is correct
24 Correct 45 ms 212 KB Output is correct
25 Correct 39 ms 308 KB Output is correct
26 Correct 48 ms 312 KB Output is correct
27 Correct 52 ms 304 KB Output is correct
28 Correct 64 ms 212 KB Output is correct
29 Correct 46 ms 304 KB Output is correct
30 Correct 46 ms 212 KB Output is correct
31 Correct 65 ms 212 KB Output is correct
32 Correct 66 ms 304 KB Output is correct
33 Correct 68 ms 308 KB Output is correct
34 Execution timed out 2081 ms 340 KB Time limit exceeded
35 Halted 0 ms 0 KB -