Submission #881355

# Submission time Handle Problem Language Result Execution time Memory
881355 2023-12-01T07:36:14 Z 1L1YA Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 5880 KB
//1L1YA
#include<bits/stdc++.h>
using namespace std;
#define ll           long long
#define Pb           push_back
#define dokme(x)     cout << x << endl, exit(0)
#define pii          pair<int,int>
#define F            first
#define S            second
#define endl         '\n'
#define sep          ' '
#define all(x)       x.begin(),x.end()
#define FastIO       ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define lc           id<<1
#define rc           lc|1

const ll mod=1e9+7;
const ll oo=4e18;
const int N=2e5+5;
const int lg=23;

int n,q;
string t,s[3][3];

void change(string &s){
    for(int i=1;i<=n;i++)
        if(s[i]=='J')
            s[i]='b';
        else if(s[i]=='O')
            s[i]='c';
        else
            s[i]='d';
}

int main(){
    FastIO

    cin >> n >> s[0][0] >> s[0][1] >> s[0][2];
    s[0][0]='#'+s[0][0];s[0][1]='#'+s[0][1];s[0][2]='#'+s[0][2];
    change(s[0][0]);change(s[0][1]);change(s[0][2]);
    for(int k=1;k<3;k++){
        s[k][0]=s[k-1][0];s[k][1]=s[k-1][1];s[k][2]=s[k-1][2];
        for(int i=1;i<=n;i++){
            if(s[k-1][1][i]==s[k-1][2][i])
                s[k][0][i]=s[k-1][1][i];
            else{
                s[k][0][i]=char(((s[k-1][1][i]-'a')^(s[k-1][2][i]-'a'))+'a');
            }
            if(s[k-1][0][i]==s[k-1][2][i])
                s[k][1][i]=s[k-1][0][i];
            else{
                s[k][1][i]=char(((s[k-1][0][i]-'a')^(s[k-1][2][i]-'a'))+'a');
            }
            if(s[k-1][1][i]==s[k-1][0][i])
                s[k][2][i]=s[k-1][1][i];
            else{
                s[k][2][i]=char(((s[k-1][1][i]-'a')^(s[k-1][0][i]-'a'))+'a');
            }
        }
    }
    cin >> q >> t;
    bool fl=0;
    t='#'+t;
    change(t);
    for(int i=0;i<3;i++)
        for(int j=0;j<3;j++)    
            if(s[i][j]==t)
                fl=1;
    if(fl)    cout << "Yes" << endl;
    else    cout << "No" << endl;
    while(q--){
        int l,r;
        char c;
        cin >> l >> r >> c;
        if(c=='J')    c='b';
        else if(c=='O')    c='c';
        else    c='d';
        for(int i=l;i<=r;i++)
            t[i]=c;
        fl=0;
        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                if(s[i][j]==t)
                    fl=1;
        if(fl)    cout << "Yes" << endl;
        else    cout << "No" << endl;
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 36 ms 744 KB Output is correct
2 Correct 43 ms 2128 KB Output is correct
3 Correct 49 ms 2020 KB Output is correct
4 Correct 38 ms 2128 KB Output is correct
5 Correct 38 ms 2132 KB Output is correct
6 Correct 37 ms 2128 KB Output is correct
7 Correct 39 ms 2132 KB Output is correct
8 Correct 40 ms 2132 KB Output is correct
9 Correct 40 ms 2296 KB Output is correct
10 Correct 40 ms 2132 KB Output is correct
11 Correct 40 ms 2132 KB Output is correct
12 Correct 39 ms 2260 KB Output is correct
13 Correct 56 ms 2128 KB Output is correct
14 Correct 41 ms 2132 KB Output is correct
15 Correct 40 ms 2080 KB Output is correct
16 Correct 40 ms 2124 KB Output is correct
17 Correct 39 ms 2132 KB Output is correct
18 Correct 50 ms 2168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 744 KB Output is correct
2 Correct 43 ms 2128 KB Output is correct
3 Correct 49 ms 2020 KB Output is correct
4 Correct 38 ms 2128 KB Output is correct
5 Correct 38 ms 2132 KB Output is correct
6 Correct 37 ms 2128 KB Output is correct
7 Correct 39 ms 2132 KB Output is correct
8 Correct 40 ms 2132 KB Output is correct
9 Correct 40 ms 2296 KB Output is correct
10 Correct 40 ms 2132 KB Output is correct
11 Correct 40 ms 2132 KB Output is correct
12 Correct 39 ms 2260 KB Output is correct
13 Correct 56 ms 2128 KB Output is correct
14 Correct 41 ms 2132 KB Output is correct
15 Correct 40 ms 2080 KB Output is correct
16 Correct 40 ms 2124 KB Output is correct
17 Correct 39 ms 2132 KB Output is correct
18 Correct 50 ms 2168 KB Output is correct
19 Correct 3187 ms 5880 KB Output is correct
20 Execution timed out 7025 ms 4564 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 36 ms 744 KB Output is correct
2 Correct 43 ms 2128 KB Output is correct
3 Correct 49 ms 2020 KB Output is correct
4 Correct 38 ms 2128 KB Output is correct
5 Correct 38 ms 2132 KB Output is correct
6 Correct 37 ms 2128 KB Output is correct
7 Correct 39 ms 2132 KB Output is correct
8 Correct 40 ms 2132 KB Output is correct
9 Correct 40 ms 2296 KB Output is correct
10 Correct 40 ms 2132 KB Output is correct
11 Correct 40 ms 2132 KB Output is correct
12 Correct 39 ms 2260 KB Output is correct
13 Correct 56 ms 2128 KB Output is correct
14 Correct 41 ms 2132 KB Output is correct
15 Correct 40 ms 2080 KB Output is correct
16 Correct 40 ms 2124 KB Output is correct
17 Correct 39 ms 2132 KB Output is correct
18 Correct 50 ms 2168 KB Output is correct
19 Correct 37 ms 2140 KB Output is correct
20 Correct 48 ms 2128 KB Output is correct
21 Correct 45 ms 2132 KB Output is correct
22 Correct 36 ms 1884 KB Output is correct
23 Correct 40 ms 1872 KB Output is correct
24 Correct 46 ms 2076 KB Output is correct
25 Correct 40 ms 1812 KB Output is correct
26 Correct 38 ms 1844 KB Output is correct
27 Correct 40 ms 1872 KB Output is correct
28 Correct 36 ms 1872 KB Output is correct
29 Correct 42 ms 1876 KB Output is correct
30 Correct 40 ms 1884 KB Output is correct
31 Correct 39 ms 1876 KB Output is correct
32 Correct 40 ms 2124 KB Output is correct
33 Correct 39 ms 1872 KB Output is correct
34 Correct 45 ms 1848 KB Output is correct
35 Correct 40 ms 2008 KB Output is correct
36 Correct 39 ms 1872 KB Output is correct
37 Correct 41 ms 1920 KB Output is correct
38 Correct 40 ms 1844 KB Output is correct
39 Correct 40 ms 2052 KB Output is correct
40 Correct 39 ms 2052 KB Output is correct
41 Correct 40 ms 1912 KB Output is correct
42 Correct 44 ms 1876 KB Output is correct
43 Correct 39 ms 1876 KB Output is correct
44 Correct 41 ms 1864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 744 KB Output is correct
2 Correct 43 ms 2128 KB Output is correct
3 Correct 49 ms 2020 KB Output is correct
4 Correct 38 ms 2128 KB Output is correct
5 Correct 38 ms 2132 KB Output is correct
6 Correct 37 ms 2128 KB Output is correct
7 Correct 39 ms 2132 KB Output is correct
8 Correct 40 ms 2132 KB Output is correct
9 Correct 40 ms 2296 KB Output is correct
10 Correct 40 ms 2132 KB Output is correct
11 Correct 40 ms 2132 KB Output is correct
12 Correct 39 ms 2260 KB Output is correct
13 Correct 56 ms 2128 KB Output is correct
14 Correct 41 ms 2132 KB Output is correct
15 Correct 40 ms 2080 KB Output is correct
16 Correct 40 ms 2124 KB Output is correct
17 Correct 39 ms 2132 KB Output is correct
18 Correct 50 ms 2168 KB Output is correct
19 Correct 3187 ms 5880 KB Output is correct
20 Execution timed out 7025 ms 4564 KB Time limit exceeded
21 Halted 0 ms 0 KB -