結果
問題 |
No.2030 Googol Strings
|
ユーザー |
|
提出日時 | 2022-08-05 23:07:42 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,185 bytes |
コンパイル時間 | 5,241 ms |
コンパイル使用メモリ | 318,808 KB |
実行使用メモリ | 290,148 KB |
最終ジャッジ日時 | 2024-09-15 20:40:03 |
合計ジャッジ時間 | 8,595 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | AC * 1 TLE * 1 -- * 14 |
ソースコード
#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; }