Submission #420319

# Submission time Handle Problem Language Result Execution time Memory
420319 2021-06-08T09:40:09 Z egorlifar Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 4524 KB
/*
KAMUI!
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓▓▓██████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓▓▓█████▓▓▓▓▓▓▓▓▓
▓▓▓▓▓▓▓███▓▒▒░▒▒▒▒▒░░░▒▒▒▓▓███▓▓▓▓▓▓▓ 
▓▓▓▓▓▓█▓▒▒▒▓▓████████▓▒▒░▒▒▒▓██▓▓▓▓▓▓
▓▓▓▓██▒▓████████████████▓░▒▒▒▒▓██▓▓▓▓ 
▓▓▓██▓███████▓▒░░░░░░░▒███▒░░▒▒▒██▓▓▓ 
▓▓█████████▓░░░░░░░░░░░░░██▓▓██████▓▓ 
▓▓█▒▓███████████▓▓▒▒▒▓▓██████████▓█▓▓ 
▓██▒▒▒███████████████████████████▓▓█▓ 
▓█▓▒▒░░████████▒░░░░▓███████████▓░▒█▓ 
▓█▒▒▒░██░▒████░░░░░░█████░░████▓░░▒█▓ 
▓█▒▒▒▒██░░░██▓░░░░░░░███▒░░████▒▒▒▒█▓ 
▓█▓▒▒▒██▒░░░▓█▓░░░░░▓█▓░░░▓███▓▒▒░▓█▓ 
▓█▓▒▒▒███░░░░████████▓░░░░░████▒▒▒▓█▓ 
▓▓█▒▒░▓███░░░▒███████▒░░░▒███▓▒▒▒▒█▓▓ 
▓▓██▒▒░████▒░░███████░░░▓███▓░▒▒▒██▓▓ 
▓▓▓██▒▒▒█████▓░░██████▒▓███▓▒░▒▒██▓▓▓ 
▓▓▓▓██▓▒░▓██████████████▓▒░▒▒▒▓██▓▓▓▓ 
▓▓▓▓▓▓██▓░▒▓█████████▒░░▒▒▒▒▓██▓▓▓▓▓▓ 
▓▓▓▓▓▓▓███▓▒▒▓██████▓░▒▒▒▓▓███▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓███▓▓▓▓███▓▓▓████▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓▓▓███████████▓▓▓▓▓▓▓▓▓▓▓▓▓ 
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
 
using namespace std;
template<typename T1, typename T2> inline void chkmin(T1 &a, T2 b) {if (a > b) a = b;}
template<typename T1, typename T2> inline void chkmax(T1 &a, T2 b) {if (a < b) a = b;}
#define files(FILENAME) read(FILENAME); write(FILENAME)
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define left left228
#define right right228
#define y1 y1228
#define mp make_pair
#define pb push_back
#define y2 y2228
#define rank rank228
using ll = long long;
using ld = long double; 
const string FILENAME = "input";
const int Mod = 998244353;


int sum(int a, int b) {
    return (a + b >= Mod ? a + b - Mod: a + b);
}


int mul(int a, int b) {
    return ((ll)a * b) % Mod;
}


int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1) {
            res = mul(res, a);
        }
        a = mul(a, a);
        b >>= 1;
    }
    return res;
}


int inv(int a) {
    return powm(a, Mod - 2);
}
 

int n;
string s[3];
int q;
string t0;


void solve() {
    cin >> n;
    for (int i = 0; i < 3; i++) {
        cin >> s[i];
    }    
    cin >> q;
    cin >> t0;
    vector<string> goods;
    for (int mask = 1; mask <= 7; mask++) {
        vector<int> st;
        for (int i = 0; i < 3; i++) {
            if (mask & (1 << i)) {
                st.pb(i);
            }
        }
        do {
            string cur;
            for (auto i: st) {
                if (cur.empty()) {
                    cur = s[i];
                } else {
                    for (int j = 0; j < n; j++) {
                        if (cur[j] == s[i][j]) {
                            continue;
                        } 
                        cur[j] = cur[j] ^ s[i][j] ^ 'J' ^ 'O' ^ 'I';
                    }
                }
            }
            goods.pb(cur);
        } while (next_permutation(all(st)));
    }
    bool ok = false;
    for (auto x: goods) {
        if (x == t0) {
            ok = true;
        }
    }
    if (ok) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
    for (int it = 0; it < q; it++) {
        int l, r;
        char c;
        cin >> l >> r >> c;
        l--, r--;
        for (int i = l; i <= r; i++) {
            t0[i] = c;
        }
        bool ok = false;
        for (auto x: goods) {
            if (x == t0) {
                ok = true;
            }
        }
        if (ok) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }      
}


int main() {
    //12:15
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // read(FILENAME);
    int t;
    t = 1;
  //  cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 162 ms 916 KB Output is correct
2 Correct 174 ms 944 KB Output is correct
3 Correct 235 ms 828 KB Output is correct
4 Correct 173 ms 860 KB Output is correct
5 Correct 203 ms 856 KB Output is correct
6 Correct 160 ms 760 KB Output is correct
7 Correct 192 ms 844 KB Output is correct
8 Correct 174 ms 840 KB Output is correct
9 Correct 177 ms 836 KB Output is correct
10 Correct 174 ms 804 KB Output is correct
11 Correct 171 ms 896 KB Output is correct
12 Correct 172 ms 888 KB Output is correct
13 Correct 167 ms 836 KB Output is correct
14 Correct 174 ms 824 KB Output is correct
15 Correct 167 ms 800 KB Output is correct
16 Correct 172 ms 896 KB Output is correct
17 Correct 171 ms 964 KB Output is correct
18 Correct 218 ms 916 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 916 KB Output is correct
2 Correct 174 ms 944 KB Output is correct
3 Correct 235 ms 828 KB Output is correct
4 Correct 173 ms 860 KB Output is correct
5 Correct 203 ms 856 KB Output is correct
6 Correct 160 ms 760 KB Output is correct
7 Correct 192 ms 844 KB Output is correct
8 Correct 174 ms 840 KB Output is correct
9 Correct 177 ms 836 KB Output is correct
10 Correct 174 ms 804 KB Output is correct
11 Correct 171 ms 896 KB Output is correct
12 Correct 172 ms 888 KB Output is correct
13 Correct 167 ms 836 KB Output is correct
14 Correct 174 ms 824 KB Output is correct
15 Correct 167 ms 800 KB Output is correct
16 Correct 172 ms 896 KB Output is correct
17 Correct 171 ms 964 KB Output is correct
18 Correct 218 ms 916 KB Output is correct
19 Execution timed out 7099 ms 4524 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 162 ms 916 KB Output is correct
2 Correct 174 ms 944 KB Output is correct
3 Correct 235 ms 828 KB Output is correct
4 Correct 173 ms 860 KB Output is correct
5 Correct 203 ms 856 KB Output is correct
6 Correct 160 ms 760 KB Output is correct
7 Correct 192 ms 844 KB Output is correct
8 Correct 174 ms 840 KB Output is correct
9 Correct 177 ms 836 KB Output is correct
10 Correct 174 ms 804 KB Output is correct
11 Correct 171 ms 896 KB Output is correct
12 Correct 172 ms 888 KB Output is correct
13 Correct 167 ms 836 KB Output is correct
14 Correct 174 ms 824 KB Output is correct
15 Correct 167 ms 800 KB Output is correct
16 Correct 172 ms 896 KB Output is correct
17 Correct 171 ms 964 KB Output is correct
18 Correct 218 ms 916 KB Output is correct
19 Correct 166 ms 1004 KB Output is correct
20 Correct 214 ms 820 KB Output is correct
21 Correct 174 ms 836 KB Output is correct
22 Correct 173 ms 740 KB Output is correct
23 Correct 169 ms 828 KB Output is correct
24 Correct 176 ms 792 KB Output is correct
25 Correct 173 ms 976 KB Output is correct
26 Correct 210 ms 836 KB Output is correct
27 Correct 169 ms 836 KB Output is correct
28 Correct 166 ms 792 KB Output is correct
29 Correct 169 ms 844 KB Output is correct
30 Correct 176 ms 804 KB Output is correct
31 Correct 213 ms 964 KB Output is correct
32 Correct 181 ms 864 KB Output is correct
33 Correct 184 ms 852 KB Output is correct
34 Correct 172 ms 884 KB Output is correct
35 Correct 172 ms 884 KB Output is correct
36 Correct 172 ms 892 KB Output is correct
37 Correct 169 ms 836 KB Output is correct
38 Correct 171 ms 884 KB Output is correct
39 Correct 173 ms 836 KB Output is correct
40 Correct 168 ms 896 KB Output is correct
41 Correct 178 ms 896 KB Output is correct
42 Correct 189 ms 884 KB Output is correct
43 Correct 186 ms 836 KB Output is correct
44 Correct 172 ms 864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 162 ms 916 KB Output is correct
2 Correct 174 ms 944 KB Output is correct
3 Correct 235 ms 828 KB Output is correct
4 Correct 173 ms 860 KB Output is correct
5 Correct 203 ms 856 KB Output is correct
6 Correct 160 ms 760 KB Output is correct
7 Correct 192 ms 844 KB Output is correct
8 Correct 174 ms 840 KB Output is correct
9 Correct 177 ms 836 KB Output is correct
10 Correct 174 ms 804 KB Output is correct
11 Correct 171 ms 896 KB Output is correct
12 Correct 172 ms 888 KB Output is correct
13 Correct 167 ms 836 KB Output is correct
14 Correct 174 ms 824 KB Output is correct
15 Correct 167 ms 800 KB Output is correct
16 Correct 172 ms 896 KB Output is correct
17 Correct 171 ms 964 KB Output is correct
18 Correct 218 ms 916 KB Output is correct
19 Execution timed out 7099 ms 4524 KB Time limit exceeded
20 Halted 0 ms 0 KB -