답안 #869904

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
869904 2023-11-06T08:12:52 Z NeroZein Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 6192 KB
#include "bits/stdc++.h"
using namespace std;

#ifdef Nero
#include "Deb.h"
#else
#define deb(...)
#endif

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<string> s(3); 
  for (int i = 0; i < 3; ++i) cin >> s[i]; 
  set<string> se;
  auto merge = [&](string a, string b) {
    string ret;
    ret.resize(n); 
    for (int i = 0; i < n; ++i) {
      if (a[i] == b[i]) {
        ret[i] = a[i];
      } else {
        if (a[i] != 'I' && b[i] != 'I') ret[i] = 'I';
        else if (a[i] != 'O' && b[i] != 'O') ret[i] = 'O';
        else if (a[i] != 'J' && b[i] != 'J') ret[i] = 'J';
        else assert(false); 
      }
    }
    return ret;
  };
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 3; ++k) {
        se.insert(merge(merge(s[i], s[j]), s[k])); 
      }
    }
  }
  //deb(se) cout << '\n';
  int q;
  cin >> q;
  string t;
  cin >> t;
  cout << (se.count(t) ? "Yes" : "No") << '\n'; 
  while (q--) {
    int l, r;
    cin >> l >> r;
    --l, --r;
    char c;
    cin >> c;
    for (int i = l; i <= r; ++i) {
      t[i] = c;
    }
    cout << (se.count(t) ? "Yes" : "No") << '\n'; 
  }
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 860 KB Output is correct
2 Correct 33 ms 2388 KB Output is correct
3 Correct 42 ms 2420 KB Output is correct
4 Correct 34 ms 2420 KB Output is correct
5 Correct 33 ms 2388 KB Output is correct
6 Correct 33 ms 2324 KB Output is correct
7 Correct 33 ms 2396 KB Output is correct
8 Correct 34 ms 2392 KB Output is correct
9 Correct 35 ms 2388 KB Output is correct
10 Correct 39 ms 2540 KB Output is correct
11 Correct 37 ms 2388 KB Output is correct
12 Correct 34 ms 2388 KB Output is correct
13 Correct 34 ms 2396 KB Output is correct
14 Correct 34 ms 2400 KB Output is correct
15 Correct 34 ms 2388 KB Output is correct
16 Correct 34 ms 2384 KB Output is correct
17 Correct 34 ms 2392 KB Output is correct
18 Correct 52 ms 2436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 860 KB Output is correct
2 Correct 33 ms 2388 KB Output is correct
3 Correct 42 ms 2420 KB Output is correct
4 Correct 34 ms 2420 KB Output is correct
5 Correct 33 ms 2388 KB Output is correct
6 Correct 33 ms 2324 KB Output is correct
7 Correct 33 ms 2396 KB Output is correct
8 Correct 34 ms 2392 KB Output is correct
9 Correct 35 ms 2388 KB Output is correct
10 Correct 39 ms 2540 KB Output is correct
11 Correct 37 ms 2388 KB Output is correct
12 Correct 34 ms 2388 KB Output is correct
13 Correct 34 ms 2396 KB Output is correct
14 Correct 34 ms 2400 KB Output is correct
15 Correct 34 ms 2388 KB Output is correct
16 Correct 34 ms 2384 KB Output is correct
17 Correct 34 ms 2392 KB Output is correct
18 Correct 52 ms 2436 KB Output is correct
19 Correct 3291 ms 6192 KB Output is correct
20 Execution timed out 7047 ms 3852 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 860 KB Output is correct
2 Correct 33 ms 2388 KB Output is correct
3 Correct 42 ms 2420 KB Output is correct
4 Correct 34 ms 2420 KB Output is correct
5 Correct 33 ms 2388 KB Output is correct
6 Correct 33 ms 2324 KB Output is correct
7 Correct 33 ms 2396 KB Output is correct
8 Correct 34 ms 2392 KB Output is correct
9 Correct 35 ms 2388 KB Output is correct
10 Correct 39 ms 2540 KB Output is correct
11 Correct 37 ms 2388 KB Output is correct
12 Correct 34 ms 2388 KB Output is correct
13 Correct 34 ms 2396 KB Output is correct
14 Correct 34 ms 2400 KB Output is correct
15 Correct 34 ms 2388 KB Output is correct
16 Correct 34 ms 2384 KB Output is correct
17 Correct 34 ms 2392 KB Output is correct
18 Correct 52 ms 2436 KB Output is correct
19 Correct 36 ms 2348 KB Output is correct
20 Correct 47 ms 2388 KB Output is correct
21 Correct 36 ms 2572 KB Output is correct
22 Correct 32 ms 2172 KB Output is correct
23 Correct 39 ms 2644 KB Output is correct
24 Correct 35 ms 2388 KB Output is correct
25 Correct 37 ms 2388 KB Output is correct
26 Correct 34 ms 2328 KB Output is correct
27 Correct 37 ms 2392 KB Output is correct
28 Correct 33 ms 2140 KB Output is correct
29 Correct 36 ms 2504 KB Output is correct
30 Correct 33 ms 2392 KB Output is correct
31 Correct 42 ms 2388 KB Output is correct
32 Correct 40 ms 2388 KB Output is correct
33 Correct 38 ms 2388 KB Output is correct
34 Correct 35 ms 2396 KB Output is correct
35 Correct 38 ms 2388 KB Output is correct
36 Correct 38 ms 2396 KB Output is correct
37 Correct 38 ms 2396 KB Output is correct
38 Correct 37 ms 2388 KB Output is correct
39 Correct 38 ms 2496 KB Output is correct
40 Correct 41 ms 2584 KB Output is correct
41 Correct 38 ms 2388 KB Output is correct
42 Correct 37 ms 2388 KB Output is correct
43 Correct 36 ms 2388 KB Output is correct
44 Correct 39 ms 2352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 860 KB Output is correct
2 Correct 33 ms 2388 KB Output is correct
3 Correct 42 ms 2420 KB Output is correct
4 Correct 34 ms 2420 KB Output is correct
5 Correct 33 ms 2388 KB Output is correct
6 Correct 33 ms 2324 KB Output is correct
7 Correct 33 ms 2396 KB Output is correct
8 Correct 34 ms 2392 KB Output is correct
9 Correct 35 ms 2388 KB Output is correct
10 Correct 39 ms 2540 KB Output is correct
11 Correct 37 ms 2388 KB Output is correct
12 Correct 34 ms 2388 KB Output is correct
13 Correct 34 ms 2396 KB Output is correct
14 Correct 34 ms 2400 KB Output is correct
15 Correct 34 ms 2388 KB Output is correct
16 Correct 34 ms 2384 KB Output is correct
17 Correct 34 ms 2392 KB Output is correct
18 Correct 52 ms 2436 KB Output is correct
19 Correct 3291 ms 6192 KB Output is correct
20 Execution timed out 7047 ms 3852 KB Time limit exceeded
21 Halted 0 ms 0 KB -