Submission #423118

# Submission time Handle Problem Language Result Execution time Memory
423118 2021-06-10T17:57:14 Z MKopchev Crossing (JOI21_crossing) C++14
26 / 100
7000 ms 1976 KB
#include<bits/stdc++.h>
using namespace std;

int n;
string inp[3];

string t;

set<string> valid;

int order[3]={0,1,2};

void check()
{
    if(valid.count(t))cout<<"Yes\n";
    else cout<<"No\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie();
    cout.tie();

    cin>>n;

    for(int i=0;i<3;i++)cin>>inp[i];

    do
    {
        string cur="";

        for(int i=0;i<=5;i++)
        {
            if(i==0)cur=inp[order[i]];
            else
            {
                int other=order[i%3];

                for(int k=0;k<n;k++)
                {
                    if(cur[k]!=inp[other][k])
                    {
                        cur[k]=1LL*'I'+'J'+'O'-cur[k]-inp[other][k];
                    }
                }
            }

            valid.insert(cur);
        }
    }
    while(next_permutation(order,order+3));

    int q;
    cin>>q;

    cin>>t;
    check();

    for(int i=1;i<=q;i++)
    {
        int l,r;
        char c;

        cin>>l>>r>>c;

        for(int j=l-1;j<r;j++)
            t[j]=c;

        check();
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 379 ms 732 KB Output is correct
2 Correct 366 ms 824 KB Output is correct
3 Correct 404 ms 804 KB Output is correct
4 Correct 356 ms 780 KB Output is correct
5 Correct 353 ms 892 KB Output is correct
6 Correct 347 ms 828 KB Output is correct
7 Correct 354 ms 832 KB Output is correct
8 Correct 371 ms 836 KB Output is correct
9 Correct 366 ms 880 KB Output is correct
10 Correct 367 ms 836 KB Output is correct
11 Correct 364 ms 936 KB Output is correct
12 Correct 385 ms 852 KB Output is correct
13 Correct 364 ms 892 KB Output is correct
14 Correct 364 ms 836 KB Output is correct
15 Correct 401 ms 896 KB Output is correct
16 Correct 364 ms 772 KB Output is correct
17 Correct 373 ms 824 KB Output is correct
18 Correct 403 ms 836 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 379 ms 732 KB Output is correct
2 Correct 366 ms 824 KB Output is correct
3 Correct 404 ms 804 KB Output is correct
4 Correct 356 ms 780 KB Output is correct
5 Correct 353 ms 892 KB Output is correct
6 Correct 347 ms 828 KB Output is correct
7 Correct 354 ms 832 KB Output is correct
8 Correct 371 ms 836 KB Output is correct
9 Correct 366 ms 880 KB Output is correct
10 Correct 367 ms 836 KB Output is correct
11 Correct 364 ms 936 KB Output is correct
12 Correct 385 ms 852 KB Output is correct
13 Correct 364 ms 892 KB Output is correct
14 Correct 364 ms 836 KB Output is correct
15 Correct 401 ms 896 KB Output is correct
16 Correct 364 ms 772 KB Output is correct
17 Correct 373 ms 824 KB Output is correct
18 Correct 403 ms 836 KB Output is correct
19 Execution timed out 7005 ms 1976 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 379 ms 732 KB Output is correct
2 Correct 366 ms 824 KB Output is correct
3 Correct 404 ms 804 KB Output is correct
4 Correct 356 ms 780 KB Output is correct
5 Correct 353 ms 892 KB Output is correct
6 Correct 347 ms 828 KB Output is correct
7 Correct 354 ms 832 KB Output is correct
8 Correct 371 ms 836 KB Output is correct
9 Correct 366 ms 880 KB Output is correct
10 Correct 367 ms 836 KB Output is correct
11 Correct 364 ms 936 KB Output is correct
12 Correct 385 ms 852 KB Output is correct
13 Correct 364 ms 892 KB Output is correct
14 Correct 364 ms 836 KB Output is correct
15 Correct 401 ms 896 KB Output is correct
16 Correct 364 ms 772 KB Output is correct
17 Correct 373 ms 824 KB Output is correct
18 Correct 403 ms 836 KB Output is correct
19 Correct 347 ms 780 KB Output is correct
20 Correct 405 ms 964 KB Output is correct
21 Correct 379 ms 932 KB Output is correct
22 Correct 337 ms 740 KB Output is correct
23 Correct 364 ms 840 KB Output is correct
24 Correct 358 ms 836 KB Output is correct
25 Correct 373 ms 840 KB Output is correct
26 Correct 352 ms 832 KB Output is correct
27 Correct 367 ms 864 KB Output is correct
28 Correct 340 ms 776 KB Output is correct
29 Correct 389 ms 848 KB Output is correct
30 Correct 366 ms 756 KB Output is correct
31 Correct 378 ms 836 KB Output is correct
32 Correct 369 ms 1028 KB Output is correct
33 Correct 373 ms 840 KB Output is correct
34 Correct 351 ms 836 KB Output is correct
35 Correct 375 ms 840 KB Output is correct
36 Correct 365 ms 980 KB Output is correct
37 Correct 390 ms 864 KB Output is correct
38 Correct 379 ms 784 KB Output is correct
39 Correct 373 ms 836 KB Output is correct
40 Correct 369 ms 808 KB Output is correct
41 Correct 372 ms 836 KB Output is correct
42 Correct 372 ms 852 KB Output is correct
43 Correct 370 ms 852 KB Output is correct
44 Correct 373 ms 960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 379 ms 732 KB Output is correct
2 Correct 366 ms 824 KB Output is correct
3 Correct 404 ms 804 KB Output is correct
4 Correct 356 ms 780 KB Output is correct
5 Correct 353 ms 892 KB Output is correct
6 Correct 347 ms 828 KB Output is correct
7 Correct 354 ms 832 KB Output is correct
8 Correct 371 ms 836 KB Output is correct
9 Correct 366 ms 880 KB Output is correct
10 Correct 367 ms 836 KB Output is correct
11 Correct 364 ms 936 KB Output is correct
12 Correct 385 ms 852 KB Output is correct
13 Correct 364 ms 892 KB Output is correct
14 Correct 364 ms 836 KB Output is correct
15 Correct 401 ms 896 KB Output is correct
16 Correct 364 ms 772 KB Output is correct
17 Correct 373 ms 824 KB Output is correct
18 Correct 403 ms 836 KB Output is correct
19 Execution timed out 7005 ms 1976 KB Time limit exceeded
20 Halted 0 ms 0 KB -