結果

問題 No.2030 Googol Strings
ユーザー V_Melville
提出日時 2022-08-05 23:03:47
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,057 bytes
コンパイル時間 5,228 ms
コンパイル使用メモリ 316,648 KB
実行使用メモリ 7,180 KB
最終ジャッジ日時 2024-09-15 20:34:57
合計ジャッジ時間 6,623 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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();
        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