結果

問題 No.2030 Googol Strings
ユーザー umezoumezo
提出日時 2022-08-06 01:31:12
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 2,148 ms
コンパイル使用メモリ 199,496 KB
実行使用メモリ 5,484 KB
最終ジャッジ日時 2023-10-14 03:43:12
合計ジャッジ時間 4,000 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,352 KB
testcase_01 AC 3 ms
4,352 KB
testcase_02 AC 3 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 18 ms
4,352 KB
testcase_05 AC 4 ms
4,348 KB
testcase_06 AC 8 ms
4,580 KB
testcase_07 AC 12 ms
5,484 KB
testcase_08 AC 13 ms
5,436 KB
testcase_09 AC 12 ms
4,352 KB
testcase_10 AC 12 ms
4,348 KB
testcase_11 AC 12 ms
4,352 KB
testcase_12 AC 27 ms
4,352 KB
testcase_13 AC 16 ms
4,348 KB
testcase_14 AC 7 ms
4,352 KB
testcase_15 AC 19 ms
4,352 KB
testcase_16 AC 12 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int t;
  cin>>t;
  while(t--){
    string s,t;
    cin>>s>>t;
    int a=s.size(),b=t.size();
    bool f=false;
    rep(i,2*max(a,b)){
      if(s[i%a]>t[i%b]){
        cout<<'X'<<endl;
        f=true;
        break;
      }
      else if(s[i%a]<t[i%b]){
        cout<<'Y'<<endl;
        f=true;
        break;
      }
    }
    if(f) continue;
    if(a>b) cout<<'X'<<endl;
    else cout<<'Y'<<endl;
  }
  
  return 0;
}
0