Submission #469489

# Submission time Handle Problem Language Result Execution time Memory
469489 2021-09-01T07:03:07 Z Jarif_Rahman Crossing (JOI21_crossing) C++17
3 / 100
7000 ms 4300 KB
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
const str joi = "JOI";
struct Query{
    str s, ss;
    bool bulid(str _s, str _ss){
        s = _s;
        ss = _ss;
        return ss == s;
    }
    bool query(int l, int r, char c){
        for(int i = l; i <= r; i++) ss[i] = c;
        return ss == s;
    }
};
str cross(str a, str b){
    int n = a.size();
    str crs = "";
    for(int i = 0; i < n; i++){
        if(a[i] == b[i]) crs+=a[i];
        else{
            for(char c: joi){
                if(c != a[i] && c != b[i]){
                    crs+=c;
                    break;
                }
            }
        }
    }
    return crs;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, q; cin >> n;
    int m = 3;
    vector<str> v(3);
    for(str &s: v) cin >> s;
    int cur = 1;
    while(1){
        for(int i = cur-1; i >= 0; i--){
            str s = cross(v[cur], v[i]);
            bool bl = 0;
            for(str ss: v) if(ss == s) bl = 1;
            if(!bl) v.pb(s);
        }
        if(m == v.size()) break;
        m = v.size();
        cur++;
    }
    m = v.size();
    str ss; cin >> q >> ss;
    vector<Query> qq(m);
    bool bl = 0;
    for(int i = 0; i < m; i++) bl|=qq[i].bulid(v[i], ss);
    cout << (bl ? "Yes\n":"No\n");
    while(q--){
        int l, r; char c; cin >> l >> r >> c; l--, r--;
        bl = 0;
        for(int i = 0; i < m; i++) bl|=qq[i].query(l, r, c);
        cout << (bl ? "Yes\n":"No\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:52:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         if(m == v.size()) break;
      |            ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2244 KB Output is correct
2 Correct 76 ms 2392 KB Output is correct
3 Correct 196 ms 2248 KB Output is correct
4 Correct 70 ms 2388 KB Output is correct
5 Correct 70 ms 2244 KB Output is correct
6 Correct 66 ms 2184 KB Output is correct
7 Correct 67 ms 2368 KB Output is correct
8 Correct 73 ms 2368 KB Output is correct
9 Correct 72 ms 2440 KB Output is correct
10 Correct 73 ms 2324 KB Output is correct
11 Correct 70 ms 2500 KB Output is correct
12 Correct 76 ms 2376 KB Output is correct
13 Correct 71 ms 2344 KB Output is correct
14 Correct 73 ms 2364 KB Output is correct
15 Correct 70 ms 2432 KB Output is correct
16 Correct 74 ms 2376 KB Output is correct
17 Correct 70 ms 2408 KB Output is correct
18 Correct 209 ms 2268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2244 KB Output is correct
2 Correct 76 ms 2392 KB Output is correct
3 Correct 196 ms 2248 KB Output is correct
4 Correct 70 ms 2388 KB Output is correct
5 Correct 70 ms 2244 KB Output is correct
6 Correct 66 ms 2184 KB Output is correct
7 Correct 67 ms 2368 KB Output is correct
8 Correct 73 ms 2368 KB Output is correct
9 Correct 72 ms 2440 KB Output is correct
10 Correct 73 ms 2324 KB Output is correct
11 Correct 70 ms 2500 KB Output is correct
12 Correct 76 ms 2376 KB Output is correct
13 Correct 71 ms 2344 KB Output is correct
14 Correct 73 ms 2364 KB Output is correct
15 Correct 70 ms 2432 KB Output is correct
16 Correct 74 ms 2376 KB Output is correct
17 Correct 70 ms 2408 KB Output is correct
18 Correct 209 ms 2268 KB Output is correct
19 Execution timed out 7051 ms 4300 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2244 KB Output is correct
2 Correct 76 ms 2392 KB Output is correct
3 Correct 196 ms 2248 KB Output is correct
4 Correct 70 ms 2388 KB Output is correct
5 Correct 70 ms 2244 KB Output is correct
6 Correct 66 ms 2184 KB Output is correct
7 Correct 67 ms 2368 KB Output is correct
8 Correct 73 ms 2368 KB Output is correct
9 Correct 72 ms 2440 KB Output is correct
10 Correct 73 ms 2324 KB Output is correct
11 Correct 70 ms 2500 KB Output is correct
12 Correct 76 ms 2376 KB Output is correct
13 Correct 71 ms 2344 KB Output is correct
14 Correct 73 ms 2364 KB Output is correct
15 Correct 70 ms 2432 KB Output is correct
16 Correct 74 ms 2376 KB Output is correct
17 Correct 70 ms 2408 KB Output is correct
18 Correct 209 ms 2268 KB Output is correct
19 Correct 133 ms 2264 KB Output is correct
20 Correct 507 ms 2296 KB Output is correct
21 Incorrect 74 ms 2428 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2244 KB Output is correct
2 Correct 76 ms 2392 KB Output is correct
3 Correct 196 ms 2248 KB Output is correct
4 Correct 70 ms 2388 KB Output is correct
5 Correct 70 ms 2244 KB Output is correct
6 Correct 66 ms 2184 KB Output is correct
7 Correct 67 ms 2368 KB Output is correct
8 Correct 73 ms 2368 KB Output is correct
9 Correct 72 ms 2440 KB Output is correct
10 Correct 73 ms 2324 KB Output is correct
11 Correct 70 ms 2500 KB Output is correct
12 Correct 76 ms 2376 KB Output is correct
13 Correct 71 ms 2344 KB Output is correct
14 Correct 73 ms 2364 KB Output is correct
15 Correct 70 ms 2432 KB Output is correct
16 Correct 74 ms 2376 KB Output is correct
17 Correct 70 ms 2408 KB Output is correct
18 Correct 209 ms 2268 KB Output is correct
19 Execution timed out 7051 ms 4300 KB Time limit exceeded
20 Halted 0 ms 0 KB -