結果

問題 No.1439 Let's Compare!!!!
ユーザー rana
提出日時 2021-09-10 23:12:02
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 408 ms / 2,000 ms
コード長 904 bytes
コンパイル時間 2,232 ms
コンパイル使用メモリ 130,036 KB
実行使用メモリ 5,848 KB
最終ジャッジ日時 2024-06-12 03:41:28
合計ジャッジ時間 7,058 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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