結果
| 問題 | No.2521 Don't be Same |
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2023-10-27 23:09:47 |
| 言語 | C (gcc 15.2.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,720 bytes |
| 記録 | |
| コンパイル時間 | 1,458 ms |
| コンパイル使用メモリ | 29,312 KB |
| 実行使用メモリ | 15,424 KB |
| 最終ジャッジ日時 | 2024-09-25 15:07:59 |
| 合計ジャッジ時間 | 7,680 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 |
| other | -- * 27 |
ソースコード
#include <stdio.h>
int main () {
int x = 0;
int y = 0;
char op[2] = "";
int i = 0;
int xx = 0;
int res = 0;
int is_fin = 0;
res = scanf("%d", &x);
res = scanf("%d", &y);
if ((x < y && x%2 == 1 && x+1==y) || (x > y && y%2 == 1 && y+1 ==x)) {
printf("Second\n");
fflush(stdout);
res = scanf("%s", op);
if (op[0] == 'A') {
res = scanf("%d", &i);
res = scanf("%d", &xx);
if (i == 1) {
x -= xx;
} else {
y -= xx;
}
} else if (op[0] == 'B') {
x = 0;
y = 0;
} else {
is_fin = 1;
}
} else {
printf("First\n");
fflush(stdout);
}
while (is_fin <= 0) {
if (x == 0) {
printf("A 2 %d\n", y);
} else if (y == 0) {
printf("A 1 %d\n", x);
} else if (x == y) {
printf("B\n");
} else if (x < y && x+1 == y) {
printf("A 2 2\n");
fflush(stdout);
y -= 2;
} else if (y < x && y+1 == x) {
printf("A 1 2\n");
fflush(stdout);
x -= 2;
} else if (x < y && x%2 == 1) {
printf("A 2 %d\n", y-x-1);
fflush(stdout);
y = x+1;
} else if (x < y) {
printf("A 2 %d\n", y-x+1);
fflush(stdout);
y = x-1;
} else if (y%2 == 1) {
printf("A 1 %d\n", x-y-1);
fflush(stdout);
x = y+1;
} else {
printf("A 1 %d\n", x-y+1);
fflush(stdout);
x = y-1;
}
res = scanf("%s", op);
if (op[0] == 'A') {
res = scanf("%d", &i);
res = scanf("%d", &xx);
if (i == 1) {
x -= xx;
} else {
y -= xx;
}
} else if (op[0] == 'B') {
x = 0;
y = 0;
} else {
is_fin = 1;
}
}
return 0;
}
chro_96