답안 #1055408

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055408 2024-08-12T18:56:29 Z YassirSalama Crossing (JOI21_crossing) C++17
26 / 100
7000 ms 2488 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<string> v(3);
    cin>>v[0]>>v[1]>>v[2];
    auto cross = [&](string a,string b){
        string s;
        for(int i=0;i<n;i++){
            if(a[i]==b[i]) s+=a[i];
            else{
                for(auto c:"JOI")
                    if(c!=a[i]&&c!=b[i]){
                        s+=c;
                        break;
                    }
            }
        }
        return s;
    };
    set<string> s(v.begin(),v.end());
    while(true){
        bool f=false;
        set<string> ss=s;
        for(auto x:s){
            for(auto y:s){
                string t=cross(x,y);
                if(s.count(t)) continue;
                ss.insert(t);f=true;
            }
        }
        s=ss;
        if(!f) break;
    }
    int q;
    cin>>q;
    string t;
    cin>>t;
    puts(s.count(t)?"Yes":"No");
    while(q--){
        int l,r;
        cin>>l>>r;
        l--,r--;
        char c;
        cin>>c;
        for(int i=l;i<=r;i++) t[i]=c;
        puts(s.count(t)?"Yes":"No");
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 207 ms 744 KB Output is correct
2 Correct 222 ms 764 KB Output is correct
3 Correct 237 ms 968 KB Output is correct
4 Correct 215 ms 848 KB Output is correct
5 Correct 218 ms 760 KB Output is correct
6 Correct 217 ms 1076 KB Output is correct
7 Correct 217 ms 828 KB Output is correct
8 Correct 226 ms 852 KB Output is correct
9 Correct 232 ms 1016 KB Output is correct
10 Correct 222 ms 852 KB Output is correct
11 Correct 220 ms 852 KB Output is correct
12 Correct 220 ms 1008 KB Output is correct
13 Correct 220 ms 968 KB Output is correct
14 Correct 245 ms 852 KB Output is correct
15 Correct 221 ms 848 KB Output is correct
16 Correct 224 ms 776 KB Output is correct
17 Correct 221 ms 876 KB Output is correct
18 Correct 232 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 207 ms 744 KB Output is correct
2 Correct 222 ms 764 KB Output is correct
3 Correct 237 ms 968 KB Output is correct
4 Correct 215 ms 848 KB Output is correct
5 Correct 218 ms 760 KB Output is correct
6 Correct 217 ms 1076 KB Output is correct
7 Correct 217 ms 828 KB Output is correct
8 Correct 226 ms 852 KB Output is correct
9 Correct 232 ms 1016 KB Output is correct
10 Correct 222 ms 852 KB Output is correct
11 Correct 220 ms 852 KB Output is correct
12 Correct 220 ms 1008 KB Output is correct
13 Correct 220 ms 968 KB Output is correct
14 Correct 245 ms 852 KB Output is correct
15 Correct 221 ms 848 KB Output is correct
16 Correct 224 ms 776 KB Output is correct
17 Correct 221 ms 876 KB Output is correct
18 Correct 232 ms 852 KB Output is correct
19 Correct 4034 ms 2476 KB Output is correct
20 Execution timed out 7035 ms 2476 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 207 ms 744 KB Output is correct
2 Correct 222 ms 764 KB Output is correct
3 Correct 237 ms 968 KB Output is correct
4 Correct 215 ms 848 KB Output is correct
5 Correct 218 ms 760 KB Output is correct
6 Correct 217 ms 1076 KB Output is correct
7 Correct 217 ms 828 KB Output is correct
8 Correct 226 ms 852 KB Output is correct
9 Correct 232 ms 1016 KB Output is correct
10 Correct 222 ms 852 KB Output is correct
11 Correct 220 ms 852 KB Output is correct
12 Correct 220 ms 1008 KB Output is correct
13 Correct 220 ms 968 KB Output is correct
14 Correct 245 ms 852 KB Output is correct
15 Correct 221 ms 848 KB Output is correct
16 Correct 224 ms 776 KB Output is correct
17 Correct 221 ms 876 KB Output is correct
18 Correct 232 ms 852 KB Output is correct
19 Correct 242 ms 756 KB Output is correct
20 Correct 231 ms 1012 KB Output is correct
21 Correct 233 ms 848 KB Output is correct
22 Correct 201 ms 2164 KB Output is correct
23 Correct 224 ms 2384 KB Output is correct
24 Correct 221 ms 2344 KB Output is correct
25 Correct 221 ms 2388 KB Output is correct
26 Correct 216 ms 2260 KB Output is correct
27 Correct 227 ms 2488 KB Output is correct
28 Correct 204 ms 2128 KB Output is correct
29 Correct 223 ms 2384 KB Output is correct
30 Correct 215 ms 2132 KB Output is correct
31 Correct 224 ms 2380 KB Output is correct
32 Correct 225 ms 2388 KB Output is correct
33 Correct 225 ms 2408 KB Output is correct
34 Correct 211 ms 2160 KB Output is correct
35 Correct 227 ms 2384 KB Output is correct
36 Correct 223 ms 2388 KB Output is correct
37 Correct 245 ms 2384 KB Output is correct
38 Correct 230 ms 2388 KB Output is correct
39 Correct 230 ms 2324 KB Output is correct
40 Correct 231 ms 2388 KB Output is correct
41 Correct 224 ms 2384 KB Output is correct
42 Correct 225 ms 2388 KB Output is correct
43 Correct 229 ms 2388 KB Output is correct
44 Correct 224 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 207 ms 744 KB Output is correct
2 Correct 222 ms 764 KB Output is correct
3 Correct 237 ms 968 KB Output is correct
4 Correct 215 ms 848 KB Output is correct
5 Correct 218 ms 760 KB Output is correct
6 Correct 217 ms 1076 KB Output is correct
7 Correct 217 ms 828 KB Output is correct
8 Correct 226 ms 852 KB Output is correct
9 Correct 232 ms 1016 KB Output is correct
10 Correct 222 ms 852 KB Output is correct
11 Correct 220 ms 852 KB Output is correct
12 Correct 220 ms 1008 KB Output is correct
13 Correct 220 ms 968 KB Output is correct
14 Correct 245 ms 852 KB Output is correct
15 Correct 221 ms 848 KB Output is correct
16 Correct 224 ms 776 KB Output is correct
17 Correct 221 ms 876 KB Output is correct
18 Correct 232 ms 852 KB Output is correct
19 Correct 4034 ms 2476 KB Output is correct
20 Execution timed out 7035 ms 2476 KB Time limit exceeded
21 Halted 0 ms 0 KB -