結果

問題 No.1439 Let's Compare!!!!
ユーザー srjywrdnprkt
提出日時 2023-06-19 16:53:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 622 ms / 2,000 ms
コード長 939 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 201,656 KB
最終ジャッジ日時 2025-02-14 22:58:08
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){

    int N, Q, x, y;
    char c;
    string S, T;
    cin >> N >> S >> T >> Q;
    set<int> sts, stl;
    for (int i=0; i<N; i++){
        if (S[i] < T[i]) sts.insert(i);
        else if (S[i] > T[i]) stl.insert(i);
    }
    
    while(Q){
        Q--;
        cin >> c >> x >> y; x--;
        sts.erase(x);
        stl.erase(x);
        if (c == 'S') S[x] = y+'0';
        else T[x] = y+'0';

        if (S[x] > T[x]) stl.insert(x);
        else if (S[x] < T[x]) sts.insert(x);
        
        if (sts.size() == 0){
            cout << (stl.size() == 0 ? "=" : ">") << endl;
            continue;
        }
        else if (stl.size() == 0){
            cout << (sts.size() == 0 ? "=" : "<") << endl;
            continue;
        }

        x = *sts.begin();
        y = *stl.begin();
        cout << (x < y ? "<" : ">") << endl;
    }

    return 0;
}
0