結果

問題 No.2521 Don't be Same
ユーザー MasKoaTSMasKoaTS
提出日時 2023-10-27 13:17:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 1,402 bytes
コンパイル時間 455 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 102,148 KB
平均クエリ数 10.43
最終ジャッジ日時 2023-10-27 13:17:38
合計ジャッジ時間 7,631 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 194 ms
102,144 KB
testcase_01 AC 179 ms
102,140 KB
testcase_02 AC 190 ms
102,140 KB
testcase_03 AC 177 ms
102,144 KB
testcase_04 AC 179 ms
102,144 KB
testcase_05 AC 181 ms
102,144 KB
testcase_06 AC 179 ms
102,144 KB
testcase_07 AC 182 ms
102,144 KB
testcase_08 AC 186 ms
102,148 KB
testcase_09 AC 184 ms
102,144 KB
testcase_10 AC 175 ms
102,140 KB
testcase_11 AC 172 ms
102,144 KB
testcase_12 AC 176 ms
102,144 KB
testcase_13 AC 178 ms
102,144 KB
testcase_14 AC 179 ms
102,144 KB
testcase_15 AC 185 ms
102,140 KB
testcase_16 AC 178 ms
102,144 KB
testcase_17 AC 178 ms
102,144 KB
testcase_18 AC 181 ms
102,144 KB
testcase_19 AC 173 ms
102,148 KB
testcase_20 AC 180 ms
102,148 KB
testcase_21 AC 180 ms
102,148 KB
testcase_22 AC 177 ms
102,144 KB
testcase_23 AC 176 ms
102,144 KB
testcase_24 AC 181 ms
102,144 KB
testcase_25 AC 181 ms
102,144 KB
testcase_26 AC 182 ms
102,140 KB
testcase_27 AC 184 ms
102,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from functools import cmp_to_key
import math
import sys
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
sys.setrecursionlimit(10 ** 6)
inp = input
getN = lambda : int(inp())
getNs = lambda : map(int, inp().split())
getList = lambda : list(map(int, inp().split()))
getStrs = lambda n : [input() for _ in [0] * n]
getEdges = lambda n : [[x - 1 for x in getNs()] for _ in [0] * n]
def yexit(): print("Yes"); exit(0)
def nexit(): print("No"); exit(0)
pi = 3.141592653589793
mod = 1000000007
MOD = 998244353
INF = 4611686018427387903
dx = [1, 0, -1, 0];  dy = [0, 1, 0, -1]
#di = coll.defaultdict(int)
 
 
"""
Main Code
"""

a = getList()

def input_judge(a):
    lis = list(map(str, inp().split()))
    if(lis[0] == 'A'):
        i, x = int(lis[1]) - 1, int(lis[2])
        a[i] -= x
    elif(lis[0] == 'B'):
        a[0] = a[1] = 0
    else:
        exit(0)

k = (a[0] > a[1])
if(a[k] & 1 and a[k] + 1 == a[k ^ 1]):
    print("Second")
    input_judge(a)
else:
    print("First")

while(True):
    if(a[0] == a[1]):
        print('B')
    else:
        k = (a[0] > a[1])
        x = a[k ^ 1]
        if(a[k] > 0):
            x = a[k ^ 1] - a[k] - 1 if(a[k] & 1) else a[k ^ 1] - a[k] + 1
        a[k ^ 1] -= x
        print('A', (k ^ 1) + 1, x)
    input_judge(a)
0