結果

問題 No.1439 Let's Compare!!!!
ユーザー simansiman
提出日時 2021-04-01 20:13:17
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 528 ms / 2,000 ms
コード長 1,233 bytes
コンパイル時間 3,686 ms
コンパイル使用メモリ 142,240 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2024-12-18 01:39:32
合計ジャッジ時間 6,904 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0