이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
///Never gonna give you up.
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
typedef long long ll;
typedef long long int lli;
typedef unsigned long long ull;
using namespace std;
using namespace __gnu_pbds;
template<class x>
using ordered_set = tree<x, null_type,less<x>, rb_tree_tag,tree_order_statistics_node_update>;
const ll mod=(ll)1e9+7;
const ll mod1=998244353;
///the defines :)
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
#define ent(arr) for(int i=0;i<arr.size();i++)cin>>arr[i];
#define all(arr) arr.begin(),arr.end()
#define allr(arr) arr.rbegin(),arr.rend()
#define sz size()
#define int long long
string cross(string a,string b)
{
    string ans;
    for(int i=0; i<a.sz; i++)
    {
        if(a[i]==b[i])
            ans+=a[i];
        else
        {
            set<char>st;
            st.insert('J');
            st.insert('O');
            st.insert('I');
            st.erase(a[i]);
            st.erase(b[i]);
            ans+=*st.begin();
        }
    }
    return ans;
}
void preprocess() {}
void solve()
{
    int n;
    cin>>n;
    string s1,s2,s3;
    cin>>s1>>s2>>s3;
    set<string>st;
    st.insert(s1);
    st.insert(s2);
    st.insert(s3);
    while(true)
    {
        int x=st.sz;
        for(auto i:st)
            for(auto j:st)
                st.insert(cross(i,j));
        if(x==st.sz)
            break;
    }
    int q;
    string t;
    cin>>q>>t;
    if(st.find(t)!=st.end())
    cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    while(q--)
    {
        int l,r;
        char x;
        cin>>l>>r>>x;
        l--,r--;
        for(int i=l; i<=r; i++)
            t[i]=x;
        if(n<=100&&st.find(t)!=st.end())
        cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
}
signed main()
{
    // freopen("div7.in","r",stdin);
    //freopen("div7.out","w",stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    preprocess();
    //bla();
    int t=1;
    //cin>>t;
    while(t--)
        solve();
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'std::string cross(std::string, std::string)':
Main.cpp:26:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for(int i=0; i<a.sz; i++)
      |                   ^
Main.cpp: In function 'void solve()':
Main.cpp:60:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::set<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         if(x==st.sz)
      |             ^| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |