Submission #818596

# Submission time Handle Problem Language Result Execution time Memory
818596 2023-08-10T05:40:19 Z vjudge1 Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 6836 KB
#include<bits/stdc++.h>

using namespace std;
using ll = long long;

int n;
string T = "JOI";

string get(string a, string b) {
    string res;
    for(int i = 0; i < n; i++)
        if(a[i] == b[i]) res += a[i];
        else {
            int k = 0;
            while(T[k] == a[i] || T[k] == b[i]) k++;
            res += T[k];
        }
    return res;
}
vector<string> st;
bool check(string s) {
    for(string cur : st)
        if(cur == s) return 1;
    return 0;
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> n;
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    st.push_back(s[0]);
    st.push_back(s[1]);
    st.push_back(s[2]);
    st.push_back(get(s[0], s[1]));
    st.push_back(get(s[0], s[2]));
    st.push_back(get(s[1], s[2]));
    st.push_back(get(s[0], get(s[1], s[2])));
    st.push_back(get(s[0], get(s[2], s[1])));
    st.push_back(get(s[1], get(s[0], s[2])));
    st.push_back(get(s[1], get(s[2], s[0])));
    st.push_back(get(s[2], get(s[0], s[1])));
    st.push_back(get(s[2], get(s[1], s[0])));

    int q;
    cin >> q;
    string t;
    cin >> t;
    cout << (check(t) ? "Yes\n" : "No\n");
    while(q--) {
        int l, r; char x;
        cin >> l >> r >> x;
        for(int i = l - 1; i < r; i++) 
            t[i] = x;
        cout << (check(t) ? "Yes\n" : "No\n");
    }
}
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2220 KB Output is correct
2 Correct 88 ms 2332 KB Output is correct
3 Correct 102 ms 2308 KB Output is correct
4 Correct 88 ms 2340 KB Output is correct
5 Correct 93 ms 2296 KB Output is correct
6 Correct 84 ms 2300 KB Output is correct
7 Correct 93 ms 2320 KB Output is correct
8 Correct 92 ms 2416 KB Output is correct
9 Correct 89 ms 2408 KB Output is correct
10 Correct 95 ms 2440 KB Output is correct
11 Correct 90 ms 2352 KB Output is correct
12 Correct 88 ms 2420 KB Output is correct
13 Correct 92 ms 2380 KB Output is correct
14 Correct 88 ms 2364 KB Output is correct
15 Correct 87 ms 2440 KB Output is correct
16 Correct 88 ms 2448 KB Output is correct
17 Correct 90 ms 2436 KB Output is correct
18 Correct 96 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2220 KB Output is correct
2 Correct 88 ms 2332 KB Output is correct
3 Correct 102 ms 2308 KB Output is correct
4 Correct 88 ms 2340 KB Output is correct
5 Correct 93 ms 2296 KB Output is correct
6 Correct 84 ms 2300 KB Output is correct
7 Correct 93 ms 2320 KB Output is correct
8 Correct 92 ms 2416 KB Output is correct
9 Correct 89 ms 2408 KB Output is correct
10 Correct 95 ms 2440 KB Output is correct
11 Correct 90 ms 2352 KB Output is correct
12 Correct 88 ms 2420 KB Output is correct
13 Correct 92 ms 2380 KB Output is correct
14 Correct 88 ms 2364 KB Output is correct
15 Correct 87 ms 2440 KB Output is correct
16 Correct 88 ms 2448 KB Output is correct
17 Correct 90 ms 2436 KB Output is correct
18 Correct 96 ms 2260 KB Output is correct
19 Execution timed out 7009 ms 6836 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2220 KB Output is correct
2 Correct 88 ms 2332 KB Output is correct
3 Correct 102 ms 2308 KB Output is correct
4 Correct 88 ms 2340 KB Output is correct
5 Correct 93 ms 2296 KB Output is correct
6 Correct 84 ms 2300 KB Output is correct
7 Correct 93 ms 2320 KB Output is correct
8 Correct 92 ms 2416 KB Output is correct
9 Correct 89 ms 2408 KB Output is correct
10 Correct 95 ms 2440 KB Output is correct
11 Correct 90 ms 2352 KB Output is correct
12 Correct 88 ms 2420 KB Output is correct
13 Correct 92 ms 2380 KB Output is correct
14 Correct 88 ms 2364 KB Output is correct
15 Correct 87 ms 2440 KB Output is correct
16 Correct 88 ms 2448 KB Output is correct
17 Correct 90 ms 2436 KB Output is correct
18 Correct 96 ms 2260 KB Output is correct
19 Correct 84 ms 2232 KB Output is correct
20 Correct 96 ms 2308 KB Output is correct
21 Correct 94 ms 2612 KB Output is correct
22 Correct 93 ms 2164 KB Output is correct
23 Correct 88 ms 2380 KB Output is correct
24 Correct 93 ms 2288 KB Output is correct
25 Correct 92 ms 2380 KB Output is correct
26 Correct 91 ms 2252 KB Output is correct
27 Correct 87 ms 2352 KB Output is correct
28 Correct 112 ms 2140 KB Output is correct
29 Correct 88 ms 2444 KB Output is correct
30 Correct 90 ms 2244 KB Output is correct
31 Correct 105 ms 2356 KB Output is correct
32 Correct 116 ms 2300 KB Output is correct
33 Correct 88 ms 2444 KB Output is correct
34 Correct 103 ms 2188 KB Output is correct
35 Correct 89 ms 2380 KB Output is correct
36 Correct 99 ms 2352 KB Output is correct
37 Correct 98 ms 2344 KB Output is correct
38 Correct 90 ms 2428 KB Output is correct
39 Correct 94 ms 2416 KB Output is correct
40 Correct 94 ms 2336 KB Output is correct
41 Correct 104 ms 2416 KB Output is correct
42 Correct 96 ms 2436 KB Output is correct
43 Correct 95 ms 2296 KB Output is correct
44 Correct 89 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 2220 KB Output is correct
2 Correct 88 ms 2332 KB Output is correct
3 Correct 102 ms 2308 KB Output is correct
4 Correct 88 ms 2340 KB Output is correct
5 Correct 93 ms 2296 KB Output is correct
6 Correct 84 ms 2300 KB Output is correct
7 Correct 93 ms 2320 KB Output is correct
8 Correct 92 ms 2416 KB Output is correct
9 Correct 89 ms 2408 KB Output is correct
10 Correct 95 ms 2440 KB Output is correct
11 Correct 90 ms 2352 KB Output is correct
12 Correct 88 ms 2420 KB Output is correct
13 Correct 92 ms 2380 KB Output is correct
14 Correct 88 ms 2364 KB Output is correct
15 Correct 87 ms 2440 KB Output is correct
16 Correct 88 ms 2448 KB Output is correct
17 Correct 90 ms 2436 KB Output is correct
18 Correct 96 ms 2260 KB Output is correct
19 Execution timed out 7009 ms 6836 KB Time limit exceeded
20 Halted 0 ms 0 KB -