Submission #600369

# Submission time Handle Problem Language Result Execution time Memory
600369 2022-07-20T19:17:53 Z Plurm Crossing (JOI21_crossing) C++11
26 / 100
7000 ms 6032 KB
#include <bits/stdc++.h>
using namespace std;

string sa, sb, sc;

string cross(string x, string y){
  if(x.empty()) return y;
  else if(y.empty()) return x;
  int n = x.size();
  string ret;
  for(int i = 0; i < n; i++){
    if(x[i] == y[i]) ret.push_back(x[i]);
    else ret.push_back(x[i] ^ y[i] ^ 'J' ^ 'O' ^ 'I');
  }
  return ret;
}

set<string> rec(int left, string cur = ""){
  if(left == 0) return {cur};
  set<string> s = {cur}, t;
  t = rec(left-1, cross(cur, sa));
  s.insert(t.begin(), t.end());
  t = rec(left-1, cross(cur, sb));
  s.insert(t.begin(), t.end());
  t = rec(left-1, cross(cur, sc));
  s.insert(t.begin(), t.end());
  return s;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n >> sa >> sb >> sc;
  set<string> pool = rec(4);
  int q;
  cin >> q;
  string t;
  cin >> t;
  cout << (pool.count(t) ? "Yes" : "No") << endl;
  while(q--){
    int l, r;
    char c;
    cin >> l >> r >> c;
    for(int i = l; i <= r; i++){
      t[i-1] = c;
    }
    cout << (pool.count(t) ? "Yes" : "No") << endl;
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 253 ms 2156 KB Output is correct
2 Correct 268 ms 2384 KB Output is correct
3 Correct 343 ms 2276 KB Output is correct
4 Correct 255 ms 2376 KB Output is correct
5 Correct 256 ms 2252 KB Output is correct
6 Correct 267 ms 2272 KB Output is correct
7 Correct 259 ms 2384 KB Output is correct
8 Correct 260 ms 2380 KB Output is correct
9 Correct 274 ms 2396 KB Output is correct
10 Correct 266 ms 2348 KB Output is correct
11 Correct 274 ms 2552 KB Output is correct
12 Correct 262 ms 2416 KB Output is correct
13 Correct 278 ms 2368 KB Output is correct
14 Correct 279 ms 2380 KB Output is correct
15 Correct 267 ms 2400 KB Output is correct
16 Correct 276 ms 2404 KB Output is correct
17 Correct 267 ms 2444 KB Output is correct
18 Correct 295 ms 2592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 253 ms 2156 KB Output is correct
2 Correct 268 ms 2384 KB Output is correct
3 Correct 343 ms 2276 KB Output is correct
4 Correct 255 ms 2376 KB Output is correct
5 Correct 256 ms 2252 KB Output is correct
6 Correct 267 ms 2272 KB Output is correct
7 Correct 259 ms 2384 KB Output is correct
8 Correct 260 ms 2380 KB Output is correct
9 Correct 274 ms 2396 KB Output is correct
10 Correct 266 ms 2348 KB Output is correct
11 Correct 274 ms 2552 KB Output is correct
12 Correct 262 ms 2416 KB Output is correct
13 Correct 278 ms 2368 KB Output is correct
14 Correct 279 ms 2380 KB Output is correct
15 Correct 267 ms 2400 KB Output is correct
16 Correct 276 ms 2404 KB Output is correct
17 Correct 267 ms 2444 KB Output is correct
18 Correct 295 ms 2592 KB Output is correct
19 Execution timed out 7037 ms 6032 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 253 ms 2156 KB Output is correct
2 Correct 268 ms 2384 KB Output is correct
3 Correct 343 ms 2276 KB Output is correct
4 Correct 255 ms 2376 KB Output is correct
5 Correct 256 ms 2252 KB Output is correct
6 Correct 267 ms 2272 KB Output is correct
7 Correct 259 ms 2384 KB Output is correct
8 Correct 260 ms 2380 KB Output is correct
9 Correct 274 ms 2396 KB Output is correct
10 Correct 266 ms 2348 KB Output is correct
11 Correct 274 ms 2552 KB Output is correct
12 Correct 262 ms 2416 KB Output is correct
13 Correct 278 ms 2368 KB Output is correct
14 Correct 279 ms 2380 KB Output is correct
15 Correct 267 ms 2400 KB Output is correct
16 Correct 276 ms 2404 KB Output is correct
17 Correct 267 ms 2444 KB Output is correct
18 Correct 295 ms 2592 KB Output is correct
19 Correct 269 ms 2392 KB Output is correct
20 Correct 306 ms 2320 KB Output is correct
21 Correct 278 ms 2396 KB Output is correct
22 Correct 250 ms 2204 KB Output is correct
23 Correct 268 ms 2404 KB Output is correct
24 Correct 267 ms 2360 KB Output is correct
25 Correct 282 ms 2388 KB Output is correct
26 Correct 248 ms 2232 KB Output is correct
27 Correct 280 ms 2392 KB Output is correct
28 Correct 246 ms 2208 KB Output is correct
29 Correct 279 ms 2380 KB Output is correct
30 Correct 241 ms 2360 KB Output is correct
31 Correct 284 ms 2380 KB Output is correct
32 Correct 262 ms 2340 KB Output is correct
33 Correct 268 ms 2408 KB Output is correct
34 Correct 274 ms 2256 KB Output is correct
35 Correct 267 ms 2540 KB Output is correct
36 Correct 308 ms 2448 KB Output is correct
37 Correct 271 ms 2408 KB Output is correct
38 Correct 283 ms 2344 KB Output is correct
39 Correct 280 ms 2440 KB Output is correct
40 Correct 273 ms 2396 KB Output is correct
41 Correct 277 ms 2476 KB Output is correct
42 Correct 268 ms 2420 KB Output is correct
43 Correct 278 ms 2312 KB Output is correct
44 Correct 276 ms 2440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 253 ms 2156 KB Output is correct
2 Correct 268 ms 2384 KB Output is correct
3 Correct 343 ms 2276 KB Output is correct
4 Correct 255 ms 2376 KB Output is correct
5 Correct 256 ms 2252 KB Output is correct
6 Correct 267 ms 2272 KB Output is correct
7 Correct 259 ms 2384 KB Output is correct
8 Correct 260 ms 2380 KB Output is correct
9 Correct 274 ms 2396 KB Output is correct
10 Correct 266 ms 2348 KB Output is correct
11 Correct 274 ms 2552 KB Output is correct
12 Correct 262 ms 2416 KB Output is correct
13 Correct 278 ms 2368 KB Output is correct
14 Correct 279 ms 2380 KB Output is correct
15 Correct 267 ms 2400 KB Output is correct
16 Correct 276 ms 2404 KB Output is correct
17 Correct 267 ms 2444 KB Output is correct
18 Correct 295 ms 2592 KB Output is correct
19 Execution timed out 7037 ms 6032 KB Time limit exceeded
20 Halted 0 ms 0 KB -