# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015499 | 2024-07-06T11:58:25 Z | daffuwu | Crossing (JOI21_crossing) | C++14 | 7000 ms | 5932 KB |
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); long long n, sz, q, l, r; bool bad; char ch; string s[3], cs, t0; vector<string> ls; map<string, bool> ex; char crot(char a, char b) { if (a>b) swap(a, b); if (a == b) return a; if (a == 'I' && b == 'J') return 'O'; if (a == 'I' && b == 'O') return 'J'; return 'I'; } string cross(string a, string b) { int i; string c = ""; for (i=0; i<n; i++) { c += crot(a[i], b[i]); } return c; } int main() { long long i, j, rr; scanf("%lld", &n); cin >> s[0] >> s[1] >> s[2]; ex[s[0]] = ex[s[1]] = ex[s[2]] = 1; for (auto [ky, _]:ex) ls.push_back(ky); for (; 1;) { sz = ls.size(); bad = 1; for (i=0; i<sz; i++) { for (j=i+1; j<sz; j++) { cs = cross(ls[i], ls[j]); if (!ex.count(cs)) { ex[cs] = 1; bad = 0; i = sz+1; break; } } } if (bad) break; ls.push_back(cs); } // printf("terdapat %lld string:\n", (long long)ls.size()); // for (auto el:ls) // { // cout << el << "\n"; // } // printf("crot\n"); scanf("%lld", &q); for (rr=0; rr<=q; rr++) { if (rr == 0) cin >> t0; else { scanf("%lld%lld %c", &l, &r, &ch); l--; r--; for (i=l; i<=r; i++) t0[i] = ch; } bad = 1; for (auto el:ls) { if (t0 == el) bad = 0; } if (bad) printf("No\n"); else printf("Yes\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 2388 KB | Output is correct |
2 | Correct | 37 ms | 2556 KB | Output is correct |
3 | Correct | 49 ms | 2388 KB | Output is correct |
4 | Correct | 36 ms | 2388 KB | Output is correct |
5 | Correct | 37 ms | 2388 KB | Output is correct |
6 | Correct | 38 ms | 2396 KB | Output is correct |
7 | Correct | 37 ms | 2384 KB | Output is correct |
8 | Correct | 37 ms | 2388 KB | Output is correct |
9 | Correct | 61 ms | 2392 KB | Output is correct |
10 | Correct | 37 ms | 2388 KB | Output is correct |
11 | Correct | 42 ms | 2384 KB | Output is correct |
12 | Correct | 37 ms | 2384 KB | Output is correct |
13 | Correct | 37 ms | 2384 KB | Output is correct |
14 | Correct | 38 ms | 2352 KB | Output is correct |
15 | Correct | 41 ms | 2384 KB | Output is correct |
16 | Correct | 42 ms | 2312 KB | Output is correct |
17 | Correct | 37 ms | 2384 KB | Output is correct |
18 | Correct | 49 ms | 2336 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 2388 KB | Output is correct |
2 | Correct | 37 ms | 2556 KB | Output is correct |
3 | Correct | 49 ms | 2388 KB | Output is correct |
4 | Correct | 36 ms | 2388 KB | Output is correct |
5 | Correct | 37 ms | 2388 KB | Output is correct |
6 | Correct | 38 ms | 2396 KB | Output is correct |
7 | Correct | 37 ms | 2384 KB | Output is correct |
8 | Correct | 37 ms | 2388 KB | Output is correct |
9 | Correct | 61 ms | 2392 KB | Output is correct |
10 | Correct | 37 ms | 2388 KB | Output is correct |
11 | Correct | 42 ms | 2384 KB | Output is correct |
12 | Correct | 37 ms | 2384 KB | Output is correct |
13 | Correct | 37 ms | 2384 KB | Output is correct |
14 | Correct | 38 ms | 2352 KB | Output is correct |
15 | Correct | 41 ms | 2384 KB | Output is correct |
16 | Correct | 42 ms | 2312 KB | Output is correct |
17 | Correct | 37 ms | 2384 KB | Output is correct |
18 | Correct | 49 ms | 2336 KB | Output is correct |
19 | Correct | 5327 ms | 5932 KB | Output is correct |
20 | Execution timed out | 7092 ms | 3628 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 2388 KB | Output is correct |
2 | Correct | 37 ms | 2556 KB | Output is correct |
3 | Correct | 49 ms | 2388 KB | Output is correct |
4 | Correct | 36 ms | 2388 KB | Output is correct |
5 | Correct | 37 ms | 2388 KB | Output is correct |
6 | Correct | 38 ms | 2396 KB | Output is correct |
7 | Correct | 37 ms | 2384 KB | Output is correct |
8 | Correct | 37 ms | 2388 KB | Output is correct |
9 | Correct | 61 ms | 2392 KB | Output is correct |
10 | Correct | 37 ms | 2388 KB | Output is correct |
11 | Correct | 42 ms | 2384 KB | Output is correct |
12 | Correct | 37 ms | 2384 KB | Output is correct |
13 | Correct | 37 ms | 2384 KB | Output is correct |
14 | Correct | 38 ms | 2352 KB | Output is correct |
15 | Correct | 41 ms | 2384 KB | Output is correct |
16 | Correct | 42 ms | 2312 KB | Output is correct |
17 | Correct | 37 ms | 2384 KB | Output is correct |
18 | Correct | 49 ms | 2336 KB | Output is correct |
19 | Correct | 83 ms | 2392 KB | Output is correct |
20 | Correct | 77 ms | 2220 KB | Output is correct |
21 | Correct | 47 ms | 2388 KB | Output is correct |
22 | Correct | 42 ms | 2136 KB | Output is correct |
23 | Correct | 43 ms | 2384 KB | Output is correct |
24 | Correct | 53 ms | 2388 KB | Output is correct |
25 | Correct | 47 ms | 2556 KB | Output is correct |
26 | Correct | 46 ms | 2408 KB | Output is correct |
27 | Correct | 62 ms | 2488 KB | Output is correct |
28 | Correct | 50 ms | 2172 KB | Output is correct |
29 | Correct | 46 ms | 2388 KB | Output is correct |
30 | Correct | 43 ms | 2304 KB | Output is correct |
31 | Correct | 66 ms | 2484 KB | Output is correct |
32 | Correct | 74 ms | 2296 KB | Output is correct |
33 | Correct | 74 ms | 2392 KB | Output is correct |
34 | Correct | 75 ms | 2376 KB | Output is correct |
35 | Correct | 69 ms | 2388 KB | Output is correct |
36 | Correct | 68 ms | 2388 KB | Output is correct |
37 | Correct | 70 ms | 2420 KB | Output is correct |
38 | Correct | 67 ms | 2388 KB | Output is correct |
39 | Correct | 70 ms | 2384 KB | Output is correct |
40 | Correct | 66 ms | 2528 KB | Output is correct |
41 | Correct | 66 ms | 2428 KB | Output is correct |
42 | Correct | 75 ms | 2388 KB | Output is correct |
43 | Correct | 79 ms | 2384 KB | Output is correct |
44 | Correct | 69 ms | 2492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 2388 KB | Output is correct |
2 | Correct | 37 ms | 2556 KB | Output is correct |
3 | Correct | 49 ms | 2388 KB | Output is correct |
4 | Correct | 36 ms | 2388 KB | Output is correct |
5 | Correct | 37 ms | 2388 KB | Output is correct |
6 | Correct | 38 ms | 2396 KB | Output is correct |
7 | Correct | 37 ms | 2384 KB | Output is correct |
8 | Correct | 37 ms | 2388 KB | Output is correct |
9 | Correct | 61 ms | 2392 KB | Output is correct |
10 | Correct | 37 ms | 2388 KB | Output is correct |
11 | Correct | 42 ms | 2384 KB | Output is correct |
12 | Correct | 37 ms | 2384 KB | Output is correct |
13 | Correct | 37 ms | 2384 KB | Output is correct |
14 | Correct | 38 ms | 2352 KB | Output is correct |
15 | Correct | 41 ms | 2384 KB | Output is correct |
16 | Correct | 42 ms | 2312 KB | Output is correct |
17 | Correct | 37 ms | 2384 KB | Output is correct |
18 | Correct | 49 ms | 2336 KB | Output is correct |
19 | Correct | 5327 ms | 5932 KB | Output is correct |
20 | Execution timed out | 7092 ms | 3628 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |