結果

問題 No.1439 Let's Compare!!!!
ユーザー tnakao0123
提出日時 2021-03-28 02:31:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 1,290 bytes
コンパイル時間 1,128 ms
コンパイル使用メモリ 100,456 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-11-29 08:57:06
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1439.cc:  No.1439 Let's Compare!!!! - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 200000;

/* typedef */

typedef set<int> si;

/* global variables */

char s[MAX_N + 4], t[MAX_N + 4];
si ks;

/* subroutines */

/* main */

int main() {
  int n, qn;
  scanf("%d%s%s%d", &n, s, t, &qn);

  for (int i = 0; i < n; i++)
    if (s[i] != t[i]) ks.insert(i);

  while (qn--) {
    char cs[4];
    int x, y;
    scanf("%s%d%d", cs, &x, &y);
    x--;
    char yc = '0' + y;

    if (cs[0] == 'S') {
      if (s[x] == t[x] && yc != t[x]) ks.insert(x);
      else if (s[x] != t[x] && yc == t[x]) ks.erase(x);
      s[x] = yc;
    }
    else {
      if (s[x] == t[x] && s[x] != yc) ks.insert(x);
      else if (s[x] != t[x] && s[x] == yc) ks.erase(x);
      t[x] = yc;
    }

    if (! ks.empty()) {
      int z = *ks.begin();
      if (s[z] < t[z]) puts("<");
      else puts(">");
    }
    else
      puts("=");
  }
  return 0;
}
0