結果

問題 No.1439 Let's Compare!!!!
ユーザー bonKotsubonKotsu
提出日時 2021-04-21 00:29:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,047 bytes
コンパイル時間 1,491 ms
コンパイル使用メモリ 167,196 KB
実行使用メモリ 9,768 KB
最終ジャッジ日時 2023-09-17 09:03:12
合計ジャッジ時間 8,887 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,884 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 8 ms
4,380 KB
testcase_08 AC 12 ms
4,376 KB
testcase_09 AC 5 ms
4,380 KB
testcase_10 AC 365 ms
5,204 KB
testcase_11 AC 369 ms
5,140 KB
testcase_12 AC 366 ms
5,168 KB
testcase_13 AC 373 ms
5,384 KB
testcase_14 AC 365 ms
5,196 KB
testcase_15 AC 376 ms
5,288 KB
testcase_16 AC 385 ms
5,204 KB
testcase_17 AC 384 ms
5,252 KB
testcase_18 TLE -
権限があれば一括ダウンロードができます

ソースコード

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>


string s, t;
vector<int> vs, vt;
int n, param;

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

void compare(int x, int& idx) {
  for (int i = x; i < n; i++) {
    if (vs[i] > vt[i]) {
      param = 0;
      idx = i;
      break;
    } else if (vs[i] < vt[i]) {
      param = 2;
      idx = i;
      break;
    } else {
      if (i < n-1) continue;
      param = 1;
      idx = i;
    }
  }
  return;
}


int main() {
  cin >> n;
  cin >> s >> t;
  vs.resize(n), vt.resize(n);
  rep(i, n) {
    vs[i] = s[i]-'0';
    vt[i] = t[i]-'0';
  }
  int idx = 0;
  compare(0, idx);

  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(param);
    else {
      compare(x, idx);
      out(param);
    }
  }


}
0