結果

問題 No.1439 Let's Compare!!!!
ユーザー tnakao0123tnakao0123
提出日時 2021-03-28 02:31:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 1,290 bytes
コンパイル時間 885 ms
コンパイル使用メモリ 98,152 KB
実行使用メモリ 12,292 KB
最終ジャッジ日時 2023-08-19 15:28:11
合計ジャッジ時間 2,760 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 106 ms
12,052 KB
testcase_11 AC 70 ms
7,128 KB
testcase_12 AC 73 ms
7,260 KB
testcase_13 AC 100 ms
12,292 KB
testcase_14 AC 100 ms
12,224 KB
testcase_15 AC 51 ms
4,592 KB
testcase_16 AC 46 ms
4,376 KB
testcase_17 AC 46 ms
4,376 KB
testcase_18 AC 42 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

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