結果

問題 No.1439 Let's Compare!!!!
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2021-03-28 14:52:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 402 ms / 2,000 ms
コード長 945 bytes
コンパイル時間 1,604 ms
コンパイル使用メモリ 176,416 KB
実行使用メモリ 12,032 KB
最終ジャッジ日時 2024-05-06 22:40:07
合計ジャッジ時間 6,301 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 8 ms
5,376 KB
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 5 ms
5,376 KB
testcase_10 AC 402 ms
11,904 KB
testcase_11 AC 369 ms
7,168 KB
testcase_12 AC 378 ms
6,912 KB
testcase_13 AC 400 ms
12,032 KB
testcase_14 AC 394 ms
12,032 KB
testcase_15 AC 347 ms
5,376 KB
testcase_16 AC 353 ms
5,376 KB
testcase_17 AC 342 ms
5,376 KB
testcase_18 AC 322 ms
5,376 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