Submission #594573

# Submission time Handle Problem Language Result Execution time Memory
594573 2022-07-12T17:03:10 Z SOCIOPATE Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 3648 KB
#include <bits/stdc++.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <vector>
#include <cmath>
#include <assert.h>
#include <ctime>
#include <math.h>
#include <queue>
#include <string>
#include <numeric>
#include <fstream>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <stack>
#include <random>
#include <list>
#include <bitset>
#include <algorithm>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define pll pair<ll, ll>
#define pii pair<int, int>
#define pdd pair<ld, ld>
#define ff first
#define ss second
#define all(v) v.begin(),v.end()

typedef tree<
    pii,
    null_type,
    less<pii>,
    rb_tree_tag,
    tree_order_statistics_node_update> ordset;


#pragma GCC optimize("-O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-Os")

ll INF = 2e18;

//mt19937 gen(time(0));

ll gcd(ll n, ll m){
    while(n != 0 && m != 0){
        if(n > m) n %= m;
        else m %= n;
    }
    return n + m;
}

ll lcm(ll n, ll m){
    ll nod = gcd(n, m);
    return n / nod * m;
}

ll mod = 1e9 + 7;

ll binpow(ll n, ll m){
    if(m == 0) return 1;
    if(m % 2ll == 1) {
        return (binpow(n, m - 1ll) * 1ll * n) % mod;
    }
    ll b = binpow(n, m / 2);
    return (b * 1ll * b) % mod;

}

void solve(){
    int n;
    cin >> n;
    vector<string> a(3);
    for(int i = 0; i < 3; i++) cin >> a[i];
    set<string> st;
    while(true){
        int u = (int)st.size();
        int n1 = (int)a.size();
        for(int i = 0; i < n1; i++){
            for(int j = 0; j < n1; j++){
                string s = "";
                for(int k = 0; k < n; k++){
                    if(a[i][k] == a[j][k]) s += a[i][k];
                    else if (a[i][k] != 'J' && a[j][k] != 'J') s += "J";
                    else if (a[i][k] != 'O' && a[j][k] != 'O') s += "O";
                    else if (a[i][k] != 'I' && a[j][k] != 'I') s += "I";
                }
                if(st.count(s)) continue;
                else{
                    a.push_back(s);
                    st.insert(s);
                }
            }
        }
        if(u == (int)st.size()) break;
    }
    int q;
    cin >> q;
    string s;
    cin >> s;
    if(st.count(s)) cout << "Yes\n";
    else cout << "No\n";
    for(int i = 0; i < q; i++){
        int l, r;
        string t;
        cin >> l >> r >> t;
        l--; r--;
        for(; l <= r; l++) s[l] = t[0];
        if(st.count(s)) cout << "Yes\n";
        else cout << "No\n";
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	int tt;
    //cin >> tt;
	tt = 1;
	while (tt--) {
		solve();
	}
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 63 ms 2184 KB Output is correct
2 Correct 70 ms 2444 KB Output is correct
3 Correct 139 ms 2288 KB Output is correct
4 Correct 63 ms 2272 KB Output is correct
5 Correct 68 ms 2248 KB Output is correct
6 Correct 67 ms 2288 KB Output is correct
7 Correct 66 ms 2396 KB Output is correct
8 Correct 74 ms 2368 KB Output is correct
9 Correct 62 ms 2436 KB Output is correct
10 Correct 60 ms 2404 KB Output is correct
11 Correct 59 ms 2376 KB Output is correct
12 Correct 63 ms 2320 KB Output is correct
13 Correct 68 ms 2368 KB Output is correct
14 Correct 63 ms 2360 KB Output is correct
15 Correct 79 ms 2392 KB Output is correct
16 Correct 71 ms 2404 KB Output is correct
17 Correct 69 ms 2388 KB Output is correct
18 Correct 144 ms 2284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 2184 KB Output is correct
2 Correct 70 ms 2444 KB Output is correct
3 Correct 139 ms 2288 KB Output is correct
4 Correct 63 ms 2272 KB Output is correct
5 Correct 68 ms 2248 KB Output is correct
6 Correct 67 ms 2288 KB Output is correct
7 Correct 66 ms 2396 KB Output is correct
8 Correct 74 ms 2368 KB Output is correct
9 Correct 62 ms 2436 KB Output is correct
10 Correct 60 ms 2404 KB Output is correct
11 Correct 59 ms 2376 KB Output is correct
12 Correct 63 ms 2320 KB Output is correct
13 Correct 68 ms 2368 KB Output is correct
14 Correct 63 ms 2360 KB Output is correct
15 Correct 79 ms 2392 KB Output is correct
16 Correct 71 ms 2404 KB Output is correct
17 Correct 69 ms 2388 KB Output is correct
18 Correct 144 ms 2284 KB Output is correct
19 Execution timed out 7081 ms 3648 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 63 ms 2184 KB Output is correct
2 Correct 70 ms 2444 KB Output is correct
3 Correct 139 ms 2288 KB Output is correct
4 Correct 63 ms 2272 KB Output is correct
5 Correct 68 ms 2248 KB Output is correct
6 Correct 67 ms 2288 KB Output is correct
7 Correct 66 ms 2396 KB Output is correct
8 Correct 74 ms 2368 KB Output is correct
9 Correct 62 ms 2436 KB Output is correct
10 Correct 60 ms 2404 KB Output is correct
11 Correct 59 ms 2376 KB Output is correct
12 Correct 63 ms 2320 KB Output is correct
13 Correct 68 ms 2368 KB Output is correct
14 Correct 63 ms 2360 KB Output is correct
15 Correct 79 ms 2392 KB Output is correct
16 Correct 71 ms 2404 KB Output is correct
17 Correct 69 ms 2388 KB Output is correct
18 Correct 144 ms 2284 KB Output is correct
19 Correct 73 ms 2360 KB Output is correct
20 Correct 148 ms 2212 KB Output is correct
21 Correct 78 ms 2428 KB Output is correct
22 Correct 52 ms 2172 KB Output is correct
23 Correct 61 ms 2440 KB Output is correct
24 Correct 60 ms 2256 KB Output is correct
25 Correct 69 ms 2432 KB Output is correct
26 Correct 55 ms 2248 KB Output is correct
27 Correct 60 ms 2324 KB Output is correct
28 Correct 58 ms 2240 KB Output is correct
29 Correct 61 ms 2356 KB Output is correct
30 Correct 61 ms 2264 KB Output is correct
31 Correct 66 ms 2380 KB Output is correct
32 Correct 65 ms 2356 KB Output is correct
33 Correct 67 ms 2380 KB Output is correct
34 Correct 55 ms 2292 KB Output is correct
35 Correct 68 ms 2464 KB Output is correct
36 Correct 63 ms 2384 KB Output is correct
37 Correct 69 ms 2364 KB Output is correct
38 Correct 67 ms 2424 KB Output is correct
39 Correct 69 ms 2380 KB Output is correct
40 Correct 64 ms 2388 KB Output is correct
41 Correct 79 ms 2376 KB Output is correct
42 Correct 64 ms 2380 KB Output is correct
43 Correct 61 ms 2296 KB Output is correct
44 Correct 63 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 2184 KB Output is correct
2 Correct 70 ms 2444 KB Output is correct
3 Correct 139 ms 2288 KB Output is correct
4 Correct 63 ms 2272 KB Output is correct
5 Correct 68 ms 2248 KB Output is correct
6 Correct 67 ms 2288 KB Output is correct
7 Correct 66 ms 2396 KB Output is correct
8 Correct 74 ms 2368 KB Output is correct
9 Correct 62 ms 2436 KB Output is correct
10 Correct 60 ms 2404 KB Output is correct
11 Correct 59 ms 2376 KB Output is correct
12 Correct 63 ms 2320 KB Output is correct
13 Correct 68 ms 2368 KB Output is correct
14 Correct 63 ms 2360 KB Output is correct
15 Correct 79 ms 2392 KB Output is correct
16 Correct 71 ms 2404 KB Output is correct
17 Correct 69 ms 2388 KB Output is correct
18 Correct 144 ms 2284 KB Output is correct
19 Execution timed out 7081 ms 3648 KB Time limit exceeded
20 Halted 0 ms 0 KB -