QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#671802#1131. CrossingWansur#0 0ms0kbC++231.8kb2024-10-24 14:31:542024-10-24 14:31:54

Judging History

你现在查看的是最新测评结果

  • [2024-10-24 14:31:54]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-10-24 14:31:54]
  • 提交

answer

#include <bits/stdc++.h>
#define ent '\n'
#define int long long

using namespace std;
typedef long long ll;

const int maxn = 1e6 + 12;
const int mod = 998244353;

int p[maxn], s[maxn];
string t;
int n, m, k;

string get(string s, string t) {
    string ans = "";
    for(int i = 0; i < n; i++) {
        if(s[i] == t[i]) {
            ans += s[i];
        }
        else {
            ans += 'J' + 'O' + 'I' - s[i] - t[i];
        }
    }
    return ans;
}

void solve() {
    string a, b, c;
    cin >> n >> a >> b >> c;
    map<string, int> was;
    was[a] = was[b] = was[c] = 1;
    vector<string> v = {a, b, c};
    while(true) {
        int c = 0;
        for(int i = 0; i < v.size(); i++) {
            for(int  j = i + 1; j < v.size(); j++) {
                if(!was[get(v[i], v[j])]) {
                    v.push_back(get(v[i], v[j]));
                    c = 1;
                    was[v.back()] = 1;
                    break;
                }
            }
            if(c) break;
        }
        if(!c) break;
    }
    
    assert(v.size() > 9);
    
    cin >> m >> t;

    auto query = [&]() -> void{
        bool fg = 0;
        for(auto s : v) {
            if(s == t) {
                fg = 1;
            }
        }
        if(fg) {
            cout << "Yes\n";
        }
        else {
            cout << "No\n";
        }
    };

    query();

    while(m--) {
        char x;
        int l, r;
        cin >> l >> r >> x;
        l--, r--;
        for(int i = l; i <= r; i++) {
            t[i] = x;
        }
        query();
    }
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
//     cin >> t;
    while(t--) {
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Runtime Error

Test #1:

score: 0
Runtime Error

input:

80
JJIJOJOJOJIJJIJJIJJIJIIIJIIJIJIJIIIJIJOOIIIJIOIIOJJOOJOJJOJJOOIIOOOOOJIIOIJOJIIJ
JJIJOJOJOJIJJIJJIJJIJIIIJIIJIJIJIIIJIJOOIIIJIOIIOJJOOJOJJOJJOOIIOOOOOJIIOIJOJIIJ
JJIJOJOJOJIJJIJJIJJIJIIIJIIJIJIJIIIJIJOOIIIJIOIIOJJOOJOJJOJJOOIIOOOOOJIIOIJOJIIJ
185606
IIJJOJIOJOIJIJJJJIOOJIIIIIIJIOIIOJOIJOIJOIJOJOI...

output:


result:


Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%