結果
| 問題 |
No.2030 Googol Strings
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-07-24 10:10:54 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 936 bytes |
| コンパイル時間 | 1,322 ms |
| コンパイル使用メモリ | 28,672 KB |
| 実行使用メモリ | 7,552 KB |
| 最終ジャッジ日時 | 2024-09-15 15:34:04 |
| 合計ジャッジ時間 | 2,897 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 WA * 2 |
ソースコード
#include <stdio.h>
int lex_smaller(char s1[], char s2[])
{
int i;
for (i = 0; s1[i] != 0 && s2[i] != 0; i++) {
if (s1[i] < s2[i]) return 1;
else if (s1[i] > s2[i]) return -1;
}
if (s1[i] == s2[i]) return 0;
else if (s1[i] == 0) return 1;
else return -1;
}
char solve(char x[], char y[])
{
int i, j;
static char xx[2000001], yy[2000001];
for (i = 0, j = 0; x[j] != 0; i++, j++) xx[i] = x[j];
for (j = 0; y[j] != 0; i++, j++) xx[i] = y[j];
for (i = 0, j = 0; y[j] != 0; i++, j++) yy[i] = y[j];
for (j = 0; x[j] != 0; i++, j++) yy[i] = x[j];
int res = lex_smaller(xx, yy);
if (res < 0) return 'X';
else if (res > 0) return 'Y';
for (i = 0; x[i] != 0; i++);
for (j = 0; y[j] != 0; j++);
if (i > j) return 'X';
else return 'Y';
}
int main()
{
int T;
char x[1000001], y[1000001];
scanf("%d", &T);
while (T--) {
scanf("%s", x);
scanf("%s", y);
printf("%c\n", solve(x, y));
}
fflush(stdout);
return 0;
}