結果

問題 No.1439 Let's Compare!!!!
ユーザー ranarana
提出日時 2021-09-10 23:12:02
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 396 ms / 2,000 ms
コード長 904 bytes
コンパイル時間 4,704 ms
コンパイル使用メモリ 91,772 KB
実行使用メモリ 5,720 KB
最終ジャッジ日時 2023-09-02 21:24:17
合計ジャッジ時間 11,271 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,372 KB
testcase_04 AC 2 ms
4,372 KB
testcase_05 AC 2 ms
4,368 KB
testcase_06 AC 1 ms
4,368 KB
testcase_07 AC 8 ms
4,372 KB
testcase_08 AC 13 ms
4,368 KB
testcase_09 AC 6 ms
4,368 KB
testcase_10 AC 385 ms
5,620 KB
testcase_11 AC 390 ms
4,632 KB
testcase_12 AC 379 ms
4,624 KB
testcase_13 AC 387 ms
5,720 KB
testcase_14 AC 385 ms
5,672 KB
testcase_15 AC 376 ms
4,608 KB
testcase_16 AC 389 ms
4,572 KB
testcase_17 AC 396 ms
4,372 KB
testcase_18 AC 342 ms
4,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

int main(void) {
    int n;
    cin >> n;

    string s, t;
    cin >> s >> t;

    priority_queue<int, vector<int>, greater<int>> que;

    for (int i = 0; i < n; ++i) {
        if (s[i] != t[i]) que.push(i);
    }

    int q;
    cin >> q;

    while (q--) {
        char c;
        int x, y;
        
        cin >> c >> x >> y;

        if (c == 'T') t[x-1] = y + '0';
        else s[x-1] = y + '0';

        if (s[x-1] != t[x-1]) que.push(x-1);

        while (!que.empty()) {
            int idx = que.top();

            if (s[idx] == t[idx]) {
                que.pop();
                continue;
            }

            if (s[idx] < t[idx]) cout << "<" << endl;
            else cout << ">" << endl;

            break;
        }
        
        if (que.empty()) cout << "=" << endl;
    }
}
0