結果

問題 No.1439 Let's Compare!!!!
ユーザー bonKotsubonKotsu
提出日時 2021-04-21 00:02:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,104 bytes
コンパイル時間 1,757 ms
コンパイル使用メモリ 166,008 KB
実行使用メモリ 5,492 KB
最終ジャッジ日時 2023-09-17 09:01:02
合計ジャッジ時間 6,279 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 376 ms
5,268 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 371 ms
5,456 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>

void out(int comp) {
  string res;
  if (comp == 0) res = ">";
  else if (comp == 1) res = "=";
  else res = "<";
  cout << res << endl;
}

int main() {
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  vector<int> vs(n), vt(n);
  rep(i, n) {
    vs[i] = s[i]-'0';
    vt[i] = t[i]-'0';
  }
  int idx = 0;
  int compare = 0; 
  rep(i, n) {
    if (vs[i] == vt[i]) {
      if (i < n-1) continue;
      else {
        compare = 1;
        idx = n-1;
      }
    } else if (vs[i] > vt[i]) {
      idx = i;
      compare = 0;
      break;
    } else {
      idx = i;
      compare = 2;
    }
  }

  int q;
  cin >> q;
  rep(i, q) {
    char c;
    int x, y;
    cin >> c >> x >> y;
    x--;
    if (c == 'S') vs[x] = y;
    else vt[x] = y;

    if (x > idx) out(compare);
    else {
      if (vs[x] > vt[x]) {
        compare = 0;
        idx = x;
      } else if (vs[x] < vt[x]) {
        compare = 2;
        idx = x;
      }
      out(compare);
    }
  }


}
0