結果
問題 |
No.1439 Let's Compare!!!!
|
ユーザー |
![]() |
提出日時 | 2021-04-01 19:58:36 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,233 bytes |
コンパイル時間 | 3,550 ms |
コンパイル使用メモリ | 144,236 KB |
実行使用メモリ | 14,592 KB |
最終ジャッジ日時 | 2024-12-18 01:05:24 |
合計ジャッジ時間 | 9,424 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 WA * 2 |
ソースコード
#include <cassert> #include <cmath> #include <algorithm> #include <iostream> #include <iomanip> #include <limits.h> #include <map> #include <queue> #include <set> #include <string.h> #include <vector> using namespace std; typedef long long ll; int compare(int y, int x) { if (y < x) { return -1; } else if (y > x) { return 1; } else { return 0; } } int main() { int N; cin >> N; string S, T; cin >> S; cin >> T; int Q; cin >> Q; int nums[N][2]; set<int> idx_list; for (int i = 0; i < N; ++i) { nums[i][0] = S[i] - '0'; nums[i][1] = T[i] - '0'; idx_list.insert(i); } char c; int x, y, state; for (int i = 0; i < Q; ++i) { cin >> c >> x >> y; --x; idx_list.insert(x); if (c == 'S') { nums[x][0] = y; } else { nums[x][1] = y; } while (!idx_list.empty()) { int idx = *idx_list.begin(); state = compare(nums[idx][0], nums[idx][1]); if (state != 0) break; idx_list.erase(idx); } switch(state) { case -1: cout << "<" << endl; break; case 0: cout << "==" << endl; break; case 1: cout << ">" << endl; break; } } return 0; }