답안 #474064

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
474064 2021-09-16T18:31:35 Z blue Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 10220 KB
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int N;

int op(int a, int b)
{
    if(a == b) return a;
    else return 0+1+2 - a - b;
}

vector<int> op(vector<int> a, vector<int> b)
{
    vector<int> r(N);
    for(int i = 0; i < N; i++) r[i] = op(a[i], b[i]);
    return r;
}

vector<int> to_num(string s)
{
    vector<int> r(N);
    for(int i = 0; i < N; i++)
    {
        if(s[i] == 'J') r[i] = 0;
        else if(s[i] == 'O') r[i] = 1;
        else if(s[i] == 'I') r[i] = 2;
    }
    return r;
}

vector<int> S[9];

void brute_check(vector<int> G)
{
    for(int i = 0; i < 9; i++) if(S[i] == G)
    {
        cout << "Yes\n";
        return;
    }
    cout << "No\n";
}

int main()
{
    cin >> N;


    for(int i = 0; i < 3; i++)
    {
        string T;
        cin >> T;
        S[i] = to_num(T);
    }

    S[3] = op(S[1], S[2]);
    S[4] = op(S[0], S[2]);
    S[5] = op(S[0], S[1]);

    S[6] = op(S[0], S[3]);
    S[7] = op(S[1], S[4]);
    S[8] = op(S[2], S[5]);


    // for(int z = 0; z < 9; z++)
    // {
    //     for(int i = 0; i < N; i++) cerr << S[z][i];
    //     cerr << '\n';
    // }
    // cerr << '\n';

    int Q;
    cin >> Q;

    string T;
    cin >> T;

    brute_check(to_num(T));
    // for(int i = 0; i < N; i++) cerr << to_num(T)[i];
    // cerr << '\n';

    for(int q = 1; q <= Q; q++)
    {
        int L, R;
        char C;
        cin >> L >> R >> C;
        for(int i = L-1; i <= R-1; i++) T[i] = C;

        brute_check(to_num(T));
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 473 ms 2140 KB Output is correct
2 Correct 536 ms 2320 KB Output is correct
3 Correct 538 ms 2232 KB Output is correct
4 Correct 510 ms 2244 KB Output is correct
5 Correct 511 ms 2372 KB Output is correct
6 Correct 584 ms 2404 KB Output is correct
7 Correct 544 ms 2332 KB Output is correct
8 Correct 526 ms 2364 KB Output is correct
9 Correct 536 ms 2400 KB Output is correct
10 Correct 552 ms 2336 KB Output is correct
11 Correct 535 ms 2424 KB Output is correct
12 Correct 538 ms 2456 KB Output is correct
13 Correct 539 ms 2408 KB Output is correct
14 Correct 609 ms 2324 KB Output is correct
15 Correct 558 ms 2312 KB Output is correct
16 Correct 547 ms 2308 KB Output is correct
17 Correct 565 ms 2420 KB Output is correct
18 Correct 540 ms 2308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 473 ms 2140 KB Output is correct
2 Correct 536 ms 2320 KB Output is correct
3 Correct 538 ms 2232 KB Output is correct
4 Correct 510 ms 2244 KB Output is correct
5 Correct 511 ms 2372 KB Output is correct
6 Correct 584 ms 2404 KB Output is correct
7 Correct 544 ms 2332 KB Output is correct
8 Correct 526 ms 2364 KB Output is correct
9 Correct 536 ms 2400 KB Output is correct
10 Correct 552 ms 2336 KB Output is correct
11 Correct 535 ms 2424 KB Output is correct
12 Correct 538 ms 2456 KB Output is correct
13 Correct 539 ms 2408 KB Output is correct
14 Correct 609 ms 2324 KB Output is correct
15 Correct 558 ms 2312 KB Output is correct
16 Correct 547 ms 2308 KB Output is correct
17 Correct 565 ms 2420 KB Output is correct
18 Correct 540 ms 2308 KB Output is correct
19 Execution timed out 7069 ms 10220 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 473 ms 2140 KB Output is correct
2 Correct 536 ms 2320 KB Output is correct
3 Correct 538 ms 2232 KB Output is correct
4 Correct 510 ms 2244 KB Output is correct
5 Correct 511 ms 2372 KB Output is correct
6 Correct 584 ms 2404 KB Output is correct
7 Correct 544 ms 2332 KB Output is correct
8 Correct 526 ms 2364 KB Output is correct
9 Correct 536 ms 2400 KB Output is correct
10 Correct 552 ms 2336 KB Output is correct
11 Correct 535 ms 2424 KB Output is correct
12 Correct 538 ms 2456 KB Output is correct
13 Correct 539 ms 2408 KB Output is correct
14 Correct 609 ms 2324 KB Output is correct
15 Correct 558 ms 2312 KB Output is correct
16 Correct 547 ms 2308 KB Output is correct
17 Correct 565 ms 2420 KB Output is correct
18 Correct 540 ms 2308 KB Output is correct
19 Correct 517 ms 2324 KB Output is correct
20 Correct 581 ms 2208 KB Output is correct
21 Correct 551 ms 2416 KB Output is correct
22 Correct 495 ms 2172 KB Output is correct
23 Correct 543 ms 2332 KB Output is correct
24 Correct 581 ms 2284 KB Output is correct
25 Correct 539 ms 2396 KB Output is correct
26 Correct 602 ms 2280 KB Output is correct
27 Correct 536 ms 2416 KB Output is correct
28 Correct 484 ms 2136 KB Output is correct
29 Correct 550 ms 2372 KB Output is correct
30 Correct 505 ms 2212 KB Output is correct
31 Correct 530 ms 2316 KB Output is correct
32 Correct 569 ms 2532 KB Output is correct
33 Correct 537 ms 2416 KB Output is correct
34 Correct 503 ms 2236 KB Output is correct
35 Correct 544 ms 2292 KB Output is correct
36 Correct 550 ms 2304 KB Output is correct
37 Correct 556 ms 2400 KB Output is correct
38 Correct 539 ms 2372 KB Output is correct
39 Correct 554 ms 2300 KB Output is correct
40 Correct 529 ms 2364 KB Output is correct
41 Correct 535 ms 2340 KB Output is correct
42 Correct 530 ms 2348 KB Output is correct
43 Correct 515 ms 2388 KB Output is correct
44 Correct 531 ms 2380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 473 ms 2140 KB Output is correct
2 Correct 536 ms 2320 KB Output is correct
3 Correct 538 ms 2232 KB Output is correct
4 Correct 510 ms 2244 KB Output is correct
5 Correct 511 ms 2372 KB Output is correct
6 Correct 584 ms 2404 KB Output is correct
7 Correct 544 ms 2332 KB Output is correct
8 Correct 526 ms 2364 KB Output is correct
9 Correct 536 ms 2400 KB Output is correct
10 Correct 552 ms 2336 KB Output is correct
11 Correct 535 ms 2424 KB Output is correct
12 Correct 538 ms 2456 KB Output is correct
13 Correct 539 ms 2408 KB Output is correct
14 Correct 609 ms 2324 KB Output is correct
15 Correct 558 ms 2312 KB Output is correct
16 Correct 547 ms 2308 KB Output is correct
17 Correct 565 ms 2420 KB Output is correct
18 Correct 540 ms 2308 KB Output is correct
19 Execution timed out 7069 ms 10220 KB Time limit exceeded
20 Halted 0 ms 0 KB -