結果

問題 No.2030 Googol Strings
ユーザー Iván SotoIván Soto
提出日時 2022-08-06 02:14:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 901 bytes
コンパイル時間 2,037 ms
コンパイル使用メモリ 198,020 KB
実行使用メモリ 5,432 KB
最終ジャッジ日時 2023-10-14 04:21:13
合計ジャッジ時間 3,685 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
4,352 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 28 ms
4,636 KB
testcase_07 AC 7 ms
5,396 KB
testcase_08 WA -
testcase_09 AC 11 ms
4,352 KB
testcase_10 AC 11 ms
4,348 KB
testcase_11 AC 11 ms
4,348 KB
testcase_12 AC 14 ms
4,352 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <algo/debug.h>
#else
#define debug(...) 42
#endif

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    string x, y;
    cin >> x >> y;
    int n = (int) min(x.size(), y.size());
    int ans = -1;
    for (int i = 0; i < n; i++) {
      if (x[i] < y[i]) {
        ans = 0;
      } else if (x[i] > y[i]) {
        ans = 1;
      }
    }
    if (ans == -1) {
      n = 2 * max((int) x.size(), (int) y.size());
      for (int i = 0; i < n; i++) {
        int px = i % (int) x.size();
        int py = i % (int) y.size();
        if (x[px] < y[py]) {
          ans = 0;
        } else if (x[px] > y[py]) {
          ans = 1;
        }
      }
    }
    if (ans == -1) {
      ans = (x.size() < y.size() ? 0 : 1);
    }
    cout << (ans == 0 ? "Y" : "X") << '\n';
  }
  return 0;
}
0