結果

問題 No.2030 Googol Strings
コンテスト
ユーザー tricky_epithet
提出日時 2026-10-07 05:05:00
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 6 ms / 2,000 ms
+ 631µs
コード長 2,280 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,894 ms
コンパイル使用メモリ 340,960 KB
実行使用メモリ 9,860 KB
最終ジャッジ日時 2026-10-07 05:05:46
合計ジャッジ時間 8,659 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// Template was built with the help of generative AI
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
 
// --------------------------- DATA STRUCTURES ---------------------------
template <typename T>
using indexed_set = tree<
    T,
    null_type,
    less<T>,
    rb_tree_tag,
    tree_order_statistics_node_update
>;
 
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
 
// --------------------------- MACROS & CONSTANTS ---------------------------

#define ll long long
#define endl "\n"
#define fast ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
 
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
const double PI = 3.141592653589;
 
// --------------------------- OBSERVATIONS ---------------------------

/* OB1:
    10101010
    01010101

    010
    101

    1  01
    0  10

    1010101 -1
    1010100 /2
    101010  /2
    10101   -1
    10100   /2
    1010    /2
    101     -1


    if msb same, that means same amount of operations

    x = 0, y = 0
    x = 2, y = 1
    5 times lets do both ways
    64, 6
    69, 192

    18 digits

    pqrstu pqrstu
    abcdea bcde

    

    10
    6
    
    abcdefghij
    pqrstu


*/

/* OB2:

*/

/* Final:

*/
 
// --------------------------- MAIN ---------------------------
int main(){
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);

    ll t; cin >> t;

    while (t--) {
        string s1, s2; cin >> s1 >> s2;

        string s3 = s1 + s2;
        string s4 = s2 + s1;

        if (s3 > s4) {
            cout << 'X' << endl;
        }
        else if (s4 > s3) {
            cout << 'Y' << endl;
        }
        else {
            if (s1.length() > s2.length()) {
                cout << 'X' << endl;
            }
            else {
                cout << 'Y' << endl;
            }
        }
    }

    return 0;
}
0