답안 #573165

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
573165 2022-06-06T07:51:56 Z Dan4Life Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 4208 KB
#include <bits/stdc++.h>
using namespace std;
string s[10], t;
int n, q, l, r;
char c;

string fun(string a, string b){
    string lol = "JOI", s = "";
    for(int i = 0; i < (int)a.size(); i++){
        if(a[i]==b[i]) { s+=a[i]; continue; }
        string x = ""; x+=a[i], x+=b[i];
        if(x[0]>x[1]) swap(x[0],x[1]);
        if(x=="IJ") s+='O';
        else if(x=="JO") s+='I';
        else s+='J';
    }
    return s;
}

bool chk(string a, string b){
    return a==b;
}

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> s[1] >> s[2] >> s[3];
    s[4] = fun(s[1], s[2]), s[5] = fun(s[1], s[3]);
    s[6] = fun(s[2], s[3]), s[7] = fun(s[4], s[3]);
    s[8] = fun(s[5], s[2]), s[9] = fun(s[6], s[1]);
    cin >> q >> t; bool ok = false;
    for(int i = 1; i <= 9; i++) ok|=chk(t,s[i]);
    cout << (ok?"Yes":"No") << "\n";
    while(q--){
        cin >> l >> r >> c; ok = false;
        for(int i = l-1; i < r; i++) t[i]=c;
        for(int i = 1; i <= 9; i++) ok|=chk(t,s[i]);
        cout << (ok?"Yes":"No") << "\n";
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 139 ms 2376 KB Output is correct
2 Correct 152 ms 2440 KB Output is correct
3 Correct 188 ms 2252 KB Output is correct
4 Correct 148 ms 2264 KB Output is correct
5 Correct 153 ms 2280 KB Output is correct
6 Correct 141 ms 2256 KB Output is correct
7 Correct 151 ms 2508 KB Output is correct
8 Correct 149 ms 2408 KB Output is correct
9 Correct 147 ms 2440 KB Output is correct
10 Correct 151 ms 2484 KB Output is correct
11 Correct 149 ms 2396 KB Output is correct
12 Correct 150 ms 2444 KB Output is correct
13 Correct 148 ms 2444 KB Output is correct
14 Correct 153 ms 2432 KB Output is correct
15 Correct 156 ms 2384 KB Output is correct
16 Correct 149 ms 2424 KB Output is correct
17 Correct 156 ms 2328 KB Output is correct
18 Correct 182 ms 2320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 139 ms 2376 KB Output is correct
2 Correct 152 ms 2440 KB Output is correct
3 Correct 188 ms 2252 KB Output is correct
4 Correct 148 ms 2264 KB Output is correct
5 Correct 153 ms 2280 KB Output is correct
6 Correct 141 ms 2256 KB Output is correct
7 Correct 151 ms 2508 KB Output is correct
8 Correct 149 ms 2408 KB Output is correct
9 Correct 147 ms 2440 KB Output is correct
10 Correct 151 ms 2484 KB Output is correct
11 Correct 149 ms 2396 KB Output is correct
12 Correct 150 ms 2444 KB Output is correct
13 Correct 148 ms 2444 KB Output is correct
14 Correct 153 ms 2432 KB Output is correct
15 Correct 156 ms 2384 KB Output is correct
16 Correct 149 ms 2424 KB Output is correct
17 Correct 156 ms 2328 KB Output is correct
18 Correct 182 ms 2320 KB Output is correct
19 Execution timed out 7043 ms 4208 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 139 ms 2376 KB Output is correct
2 Correct 152 ms 2440 KB Output is correct
3 Correct 188 ms 2252 KB Output is correct
4 Correct 148 ms 2264 KB Output is correct
5 Correct 153 ms 2280 KB Output is correct
6 Correct 141 ms 2256 KB Output is correct
7 Correct 151 ms 2508 KB Output is correct
8 Correct 149 ms 2408 KB Output is correct
9 Correct 147 ms 2440 KB Output is correct
10 Correct 151 ms 2484 KB Output is correct
11 Correct 149 ms 2396 KB Output is correct
12 Correct 150 ms 2444 KB Output is correct
13 Correct 148 ms 2444 KB Output is correct
14 Correct 153 ms 2432 KB Output is correct
15 Correct 156 ms 2384 KB Output is correct
16 Correct 149 ms 2424 KB Output is correct
17 Correct 156 ms 2328 KB Output is correct
18 Correct 182 ms 2320 KB Output is correct
19 Correct 147 ms 2272 KB Output is correct
20 Correct 182 ms 2316 KB Output is correct
21 Correct 148 ms 2416 KB Output is correct
22 Correct 136 ms 2224 KB Output is correct
23 Correct 162 ms 2496 KB Output is correct
24 Correct 148 ms 2332 KB Output is correct
25 Correct 148 ms 2412 KB Output is correct
26 Correct 148 ms 2344 KB Output is correct
27 Correct 149 ms 2396 KB Output is correct
28 Correct 139 ms 2200 KB Output is correct
29 Correct 151 ms 2416 KB Output is correct
30 Correct 139 ms 2360 KB Output is correct
31 Correct 148 ms 2380 KB Output is correct
32 Correct 148 ms 2376 KB Output is correct
33 Correct 154 ms 2380 KB Output is correct
34 Correct 141 ms 2192 KB Output is correct
35 Correct 147 ms 2340 KB Output is correct
36 Correct 145 ms 2408 KB Output is correct
37 Correct 150 ms 2368 KB Output is correct
38 Correct 147 ms 2392 KB Output is correct
39 Correct 150 ms 2448 KB Output is correct
40 Correct 152 ms 2392 KB Output is correct
41 Correct 152 ms 2420 KB Output is correct
42 Correct 153 ms 2352 KB Output is correct
43 Correct 150 ms 2352 KB Output is correct
44 Correct 148 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 139 ms 2376 KB Output is correct
2 Correct 152 ms 2440 KB Output is correct
3 Correct 188 ms 2252 KB Output is correct
4 Correct 148 ms 2264 KB Output is correct
5 Correct 153 ms 2280 KB Output is correct
6 Correct 141 ms 2256 KB Output is correct
7 Correct 151 ms 2508 KB Output is correct
8 Correct 149 ms 2408 KB Output is correct
9 Correct 147 ms 2440 KB Output is correct
10 Correct 151 ms 2484 KB Output is correct
11 Correct 149 ms 2396 KB Output is correct
12 Correct 150 ms 2444 KB Output is correct
13 Correct 148 ms 2444 KB Output is correct
14 Correct 153 ms 2432 KB Output is correct
15 Correct 156 ms 2384 KB Output is correct
16 Correct 149 ms 2424 KB Output is correct
17 Correct 156 ms 2328 KB Output is correct
18 Correct 182 ms 2320 KB Output is correct
19 Execution timed out 7043 ms 4208 KB Time limit exceeded
20 Halted 0 ms 0 KB -