답안 #495320

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495320 2021-12-18T11:46:37 Z 600Mihnea Monochrome Points (JOI20_monochrome) C++17
25 / 100
2000 ms 332 KB
#include <iostream>
#include <vector>
#include <string>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;
const int N = 400000 + 7;
int n;
string s;


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

  cin >> n >> s;
 
  vector<int> a, b;
  for (int i = 0; i < 2 * n; i++) {
    if (s[i] != s[0]) {
      a.push_back(i);
    }
    else {
      b.push_back(i);
    }
  }
  vector<ll> cnt(n);

  ll sol = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      for (int shift = 0; shift < n; shift++) {
        int i2 = (i + shift) % n;
        int j2 = (j + shift) % n;
        if (min(a[i], b[i2]) < min(a[j], b[j2]) && min(a[j], b[j2]) < max(a[i], b[i2]) && max(a[i], b[i2]) < max(a[j], b[j2])) {
          cnt[shift]++;
        }
      }
    }
  }


  for (auto& x : cnt) {
    sol = max(sol, x);
  }
  cout << sol << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 204 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 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 246 ms 316 KB Output is correct
15 Correct 252 ms 296 KB Output is correct
16 Correct 244 ms 204 KB Output is correct
17 Correct 236 ms 308 KB Output is correct
18 Correct 168 ms 296 KB Output is correct
19 Correct 194 ms 204 KB Output is correct
20 Correct 192 ms 204 KB Output is correct
21 Correct 173 ms 304 KB Output is correct
22 Correct 176 ms 204 KB Output is correct
23 Correct 67 ms 296 KB Output is correct
24 Correct 167 ms 296 KB Output is correct
25 Correct 158 ms 300 KB Output is correct
26 Correct 181 ms 292 KB Output is correct
27 Correct 204 ms 296 KB Output is correct
28 Correct 253 ms 296 KB Output is correct
29 Correct 179 ms 312 KB Output is correct
30 Correct 178 ms 204 KB Output is correct
31 Correct 264 ms 292 KB Output is correct
32 Correct 263 ms 296 KB Output is correct
33 Correct 259 ms 296 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 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 246 ms 316 KB Output is correct
15 Correct 252 ms 296 KB Output is correct
16 Correct 244 ms 204 KB Output is correct
17 Correct 236 ms 308 KB Output is correct
18 Correct 168 ms 296 KB Output is correct
19 Correct 194 ms 204 KB Output is correct
20 Correct 192 ms 204 KB Output is correct
21 Correct 173 ms 304 KB Output is correct
22 Correct 176 ms 204 KB Output is correct
23 Correct 67 ms 296 KB Output is correct
24 Correct 167 ms 296 KB Output is correct
25 Correct 158 ms 300 KB Output is correct
26 Correct 181 ms 292 KB Output is correct
27 Correct 204 ms 296 KB Output is correct
28 Correct 253 ms 296 KB Output is correct
29 Correct 179 ms 312 KB Output is correct
30 Correct 178 ms 204 KB Output is correct
31 Correct 264 ms 292 KB Output is correct
32 Correct 263 ms 296 KB Output is correct
33 Correct 259 ms 296 KB Output is correct
34 Execution timed out 2083 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 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 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 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 246 ms 316 KB Output is correct
15 Correct 252 ms 296 KB Output is correct
16 Correct 244 ms 204 KB Output is correct
17 Correct 236 ms 308 KB Output is correct
18 Correct 168 ms 296 KB Output is correct
19 Correct 194 ms 204 KB Output is correct
20 Correct 192 ms 204 KB Output is correct
21 Correct 173 ms 304 KB Output is correct
22 Correct 176 ms 204 KB Output is correct
23 Correct 67 ms 296 KB Output is correct
24 Correct 167 ms 296 KB Output is correct
25 Correct 158 ms 300 KB Output is correct
26 Correct 181 ms 292 KB Output is correct
27 Correct 204 ms 296 KB Output is correct
28 Correct 253 ms 296 KB Output is correct
29 Correct 179 ms 312 KB Output is correct
30 Correct 178 ms 204 KB Output is correct
31 Correct 264 ms 292 KB Output is correct
32 Correct 263 ms 296 KB Output is correct
33 Correct 259 ms 296 KB Output is correct
34 Execution timed out 2083 ms 332 KB Time limit exceeded
35 Halted 0 ms 0 KB -