結果

問題 No.1439 Let's Compare!!!!
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2021-03-28 14:52:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 435 ms / 2,000 ms
コード長 945 bytes
コンパイル時間 2,097 ms
コンパイル使用メモリ 174,700 KB
実行使用メモリ 11,828 KB
最終ジャッジ日時 2023-08-19 15:34:59
合計ジャッジ時間 6,798 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 8 ms
4,376 KB
testcase_08 AC 13 ms
4,380 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 428 ms
11,780 KB
testcase_11 AC 413 ms
6,740 KB
testcase_12 AC 404 ms
6,836 KB
testcase_13 AC 435 ms
11,816 KB
testcase_14 AC 425 ms
11,828 KB
testcase_15 AC 385 ms
4,376 KB
testcase_16 AC 375 ms
4,380 KB
testcase_17 AC 379 ms
4,384 KB
testcase_18 AC 350 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2021.03.28 14:51:59
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n;cin >> n;
    string s,t;cin >> s >> t;
    int q;cin >> q;
    set<int> st;
    vector<bool> exist(n,false);
    for (int i = 0; i < n; i++) if (s[i] != t[i]) st.insert(i), exist[i]=true;
    while(q--) {
        char c;
        int x,y;cin >> c >> x >> y;
        if (c == 'S') s[x-1] = char(y+'0');
        else t[x-1] = char(y+'0');
        if (s[x-1] != t[x-1]) {
            if (!exist[x-1]) st.insert(x-1);
            exist[x-1]=true;
        }
        else {
            if (exist[x-1]) st.erase(x-1);
            exist[x-1]=false;
        }
        if (st.empty()) cout << "=" << endl;
        else {
            int k = *(st.begin());
            if (s[k] < t[k]) cout << '<' << endl;
            else cout << '>' << endl;
        }
    }
    return 0;
}
0