結果

問題 No.2030 Googol Strings
ユーザー V_MelvilleV_Melville
提出日時 2022-08-05 23:07:42
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,185 bytes
コンパイル時間 4,206 ms
コンパイル使用メモリ 318,536 KB
実行使用メモリ 813,420 KB
最終ジャッジ日時 2023-10-14 00:53:42
合計ジャッジ時間 8,878 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/extc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::istream;
using std::ostream;
using ll = long long;

int main() {
    int t;
    cin >> t;
    
    while (t--) {
        string x, y;
        cin >> x >> y;
        int n1 = x.size();
        int n2 = y.size();
        int m = std::lcm(n1, n2);
        string X;
        rep(i, m/n1) X += x;
        string Y;
        rep(i, m/n2) Y += y;
        if (n1 > n2) {
            if (x.substr(0, n2) == y) {
                if (y[0] > x[n2]) puts("Y");
                else puts("X");
            }
            else {
                if (X > Y) puts("X");
                else puts("Y");
            }
        }
        else if (n1 == n2) {
            if (x > y) puts("X");
            else puts("Y");
        }
        else {
            if (y.substr(0, n1) == x) {
                if (x[0] > y[n1]) puts("X");
                else puts("Y");
            }
            else {
                if (X < Y) puts("Y");
                else puts("X");
            }
        }
    }
    
    return 0;
}
0