제출 #469489

#제출 시각아이디문제언어결과실행 시간메모리
469489Jarif_RahmanCrossing (JOI21_crossing)C++17
3 / 100
7051 ms4300 KiB
#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");
    }
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...