結果

問題 No.1439 Let's Compare!!!!
ユーザー roaris
提出日時 2021-03-26 21:54:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 764 bytes
コンパイル時間 4,711 ms
コンパイル使用メモリ 199,924 KB
最終ジャッジ日時 2025-01-19 22:30:55
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<n; i++)
#define pb push_back

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N;
    string S, T; cin >> S >> T;
    set<int> s;
    rep(i, N) if (S[i]!=T[i]) s.insert(i);
    
    int Q; cin >> Q;
    while (Q--) {
        char c;
        int x;
        char y;
        cin >> c >> x >> y;
        x--;
        
        if (c=='S') S[x] = y;
        else T[x] = y;
        
        if (s.find(x)!=s.end() && S[x]==T[x]) s.erase(x);
        if (s.find(x)==s.end() && S[x]!=T[x]) s.insert(x);
        
        if (s.size()==0) cout << '=' << endl;
        else if (S[*s.begin()]>T[*s.begin()]) cout << '>' << endl;
        else cout << '<' << endl;
    }
}
0