# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1109240 | 2024-11-06T08:45:31 Z | SalihSahin | Crossing (JOI21_crossing) | C++14 | 7000 ms | 5644 KB |
#include <bits/stdc++.h> #define pb push_back #define int long long using namespace std; const int mod = 998244353; const int inf = 1e9 + 20; const int N = 1e5+5; string op(string a, string b){ string res = ""; for(int i = 0; i < a.size(); i++){ if(a[i] == b[i]) res += a[i]; else{ if(a[i] == 'J'){ if(b[i] == 'O') res += 'I'; else res += 'O'; } else if(a[i] == 'O'){ if(b[i] == 'J') res += 'I'; else res += 'J'; } else{ if(b[i] == 'O') res += 'J'; else res += 'O'; } } } return res; } int32_t main(){ cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false); int n; cin>>n; vector<string> v; set<string> vis; for(int i = 0; i < 3; i++){ string s; cin>>s; if(vis.find(s) != vis.end()) continue; vis.insert(s); v.pb(s); } if(v.size() > 1){ sort(v.begin(), v.end()); do{ string p1 = op(v[0], v[1]); if(vis.find(p1) == vis.end()){ vis.insert(p1); } if(v.size() >= 3){ string p2 = op(p1, v[2]); if(vis.find(p2) == vis.end()){ vis.insert(p2); } } } while(next_permutation(v.begin(), v.end())); } vector<string> can; for(auto itr: vis){ can.pb(itr); } int q; cin>>q; string check; cin>>check; bool ok = 0; for(auto itr: can){ if(itr == check) ok = 1; } if(ok) cout<<"Yes"<<endl; else cout<<"No"<<endl; int l, r; char c; while(q--){ cin>>l>>r>>c; l--, r--; ok = 0; for(int i = l; i <= r; i++){ check[i] = c; } for(auto itr: can){ if(itr == check) ok = 1; } if(ok) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 2376 KB | Output is correct |
2 | Correct | 312 ms | 2376 KB | Output is correct |
3 | Correct | 332 ms | 2376 KB | Output is correct |
4 | Correct | 299 ms | 2376 KB | Output is correct |
5 | Correct | 298 ms | 2376 KB | Output is correct |
6 | Correct | 304 ms | 2376 KB | Output is correct |
7 | Correct | 308 ms | 2520 KB | Output is correct |
8 | Correct | 311 ms | 2516 KB | Output is correct |
9 | Correct | 317 ms | 2368 KB | Output is correct |
10 | Correct | 316 ms | 2680 KB | Output is correct |
11 | Correct | 314 ms | 2376 KB | Output is correct |
12 | Correct | 309 ms | 2376 KB | Output is correct |
13 | Correct | 324 ms | 2580 KB | Output is correct |
14 | Correct | 307 ms | 2376 KB | Output is correct |
15 | Correct | 324 ms | 2380 KB | Output is correct |
16 | Correct | 308 ms | 2376 KB | Output is correct |
17 | Correct | 312 ms | 2376 KB | Output is correct |
18 | Correct | 318 ms | 2384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 2376 KB | Output is correct |
2 | Correct | 312 ms | 2376 KB | Output is correct |
3 | Correct | 332 ms | 2376 KB | Output is correct |
4 | Correct | 299 ms | 2376 KB | Output is correct |
5 | Correct | 298 ms | 2376 KB | Output is correct |
6 | Correct | 304 ms | 2376 KB | Output is correct |
7 | Correct | 308 ms | 2520 KB | Output is correct |
8 | Correct | 311 ms | 2516 KB | Output is correct |
9 | Correct | 317 ms | 2368 KB | Output is correct |
10 | Correct | 316 ms | 2680 KB | Output is correct |
11 | Correct | 314 ms | 2376 KB | Output is correct |
12 | Correct | 309 ms | 2376 KB | Output is correct |
13 | Correct | 324 ms | 2580 KB | Output is correct |
14 | Correct | 307 ms | 2376 KB | Output is correct |
15 | Correct | 324 ms | 2380 KB | Output is correct |
16 | Correct | 308 ms | 2376 KB | Output is correct |
17 | Correct | 312 ms | 2376 KB | Output is correct |
18 | Correct | 318 ms | 2384 KB | Output is correct |
19 | Correct | 5691 ms | 5644 KB | Output is correct |
20 | Execution timed out | 7052 ms | 3032 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 2376 KB | Output is correct |
2 | Correct | 312 ms | 2376 KB | Output is correct |
3 | Correct | 332 ms | 2376 KB | Output is correct |
4 | Correct | 299 ms | 2376 KB | Output is correct |
5 | Correct | 298 ms | 2376 KB | Output is correct |
6 | Correct | 304 ms | 2376 KB | Output is correct |
7 | Correct | 308 ms | 2520 KB | Output is correct |
8 | Correct | 311 ms | 2516 KB | Output is correct |
9 | Correct | 317 ms | 2368 KB | Output is correct |
10 | Correct | 316 ms | 2680 KB | Output is correct |
11 | Correct | 314 ms | 2376 KB | Output is correct |
12 | Correct | 309 ms | 2376 KB | Output is correct |
13 | Correct | 324 ms | 2580 KB | Output is correct |
14 | Correct | 307 ms | 2376 KB | Output is correct |
15 | Correct | 324 ms | 2380 KB | Output is correct |
16 | Correct | 308 ms | 2376 KB | Output is correct |
17 | Correct | 312 ms | 2376 KB | Output is correct |
18 | Correct | 318 ms | 2384 KB | Output is correct |
19 | Correct | 361 ms | 2408 KB | Output is correct |
20 | Correct | 348 ms | 2376 KB | Output is correct |
21 | Correct | 329 ms | 2380 KB | Output is correct |
22 | Correct | 290 ms | 2376 KB | Output is correct |
23 | Correct | 317 ms | 2372 KB | Output is correct |
24 | Correct | 307 ms | 2368 KB | Output is correct |
25 | Correct | 316 ms | 2520 KB | Output is correct |
26 | Correct | 314 ms | 2252 KB | Output is correct |
27 | Correct | 318 ms | 2436 KB | Output is correct |
28 | Correct | 297 ms | 2352 KB | Output is correct |
29 | Correct | 318 ms | 2376 KB | Output is correct |
30 | Correct | 317 ms | 2376 KB | Output is correct |
31 | Correct | 340 ms | 2376 KB | Output is correct |
32 | Correct | 342 ms | 2376 KB | Output is correct |
33 | Correct | 341 ms | 2548 KB | Output is correct |
34 | Correct | 320 ms | 2376 KB | Output is correct |
35 | Correct | 362 ms | 2492 KB | Output is correct |
36 | Correct | 339 ms | 2376 KB | Output is correct |
37 | Correct | 356 ms | 2696 KB | Output is correct |
38 | Correct | 355 ms | 2432 KB | Output is correct |
39 | Correct | 348 ms | 2376 KB | Output is correct |
40 | Correct | 351 ms | 2376 KB | Output is correct |
41 | Correct | 344 ms | 2632 KB | Output is correct |
42 | Correct | 351 ms | 2384 KB | Output is correct |
43 | Correct | 344 ms | 2376 KB | Output is correct |
44 | Correct | 348 ms | 2544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 295 ms | 2376 KB | Output is correct |
2 | Correct | 312 ms | 2376 KB | Output is correct |
3 | Correct | 332 ms | 2376 KB | Output is correct |
4 | Correct | 299 ms | 2376 KB | Output is correct |
5 | Correct | 298 ms | 2376 KB | Output is correct |
6 | Correct | 304 ms | 2376 KB | Output is correct |
7 | Correct | 308 ms | 2520 KB | Output is correct |
8 | Correct | 311 ms | 2516 KB | Output is correct |
9 | Correct | 317 ms | 2368 KB | Output is correct |
10 | Correct | 316 ms | 2680 KB | Output is correct |
11 | Correct | 314 ms | 2376 KB | Output is correct |
12 | Correct | 309 ms | 2376 KB | Output is correct |
13 | Correct | 324 ms | 2580 KB | Output is correct |
14 | Correct | 307 ms | 2376 KB | Output is correct |
15 | Correct | 324 ms | 2380 KB | Output is correct |
16 | Correct | 308 ms | 2376 KB | Output is correct |
17 | Correct | 312 ms | 2376 KB | Output is correct |
18 | Correct | 318 ms | 2384 KB | Output is correct |
19 | Correct | 5691 ms | 5644 KB | Output is correct |
20 | Execution timed out | 7052 ms | 3032 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |