結果

問題 No.1439 Let's Compare!!!!
ユーザー lasjg72lasjg72
提出日時 2021-03-27 01:59:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 435 ms / 2,000 ms
コード長 1,129 bytes
コンパイル時間 739 ms
コンパイル使用メモリ 89,780 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-11-29 08:54:46
合計ジャッジ時間 5,394 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cassert>

using namespace std;
using ll = long long;

int main()
{
    int n, q;
    string s, t;
    cin >> n >> s >> t >> q;
    set<int> num;
    for(int i = 0; i < n; i++){
        if(s[i] != t[i]) num.insert(i);
    }
    while(q--){
        char c, y;
        int x;
        cin >> c >> x >> y;
        x--;
        int now;
        if(c == 'S'){
            s[x] = y;
            if(s[x] != t[x]){
                num.insert(x);
            }else{
                num.erase(x);
            }
            now = *num.begin();
        }else{
            t[x] = y;
            if(s[x] != t[x]){
                num.insert(x);
            }else{
                num.erase(x);
            }
            now = *num.begin();
        }
        if(s[now]-'0' > t[now] -'0'){
            cout << '>' << endl;
        }else if(s[now]-'0' < t[now] -'0'){
            cout << '<' << endl;
        }else{
            cout << '=' << endl;
        }
    }
    return 0;
}
0