結果

問題 No.3661 Grid Paint Game
コンテスト
ユーザー Rapca1256
提出日時 2026-08-30 14:55:57
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 1,121 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 528 ms
コンパイル使用メモリ 21,412 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2026-08-30 14:56:36
合計ジャッジ時間 14,566 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 1 TLE * 5 -- * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
import math
#from collections import deque, defaultdict, Counter
#import heapq
#import bisect
#import itertools
#import functools

# 外部ライブラリ(AtCoder環境で利用可能)
#from sortedcontainers import SortedList, SortedSet, SortedDict
#from atcoder.dsu import DSU
#from atcoder.segtree import SegTree
#from atcoder.lazysegtree import LazySegTree
#from atcoder.fenwicktree import FenwickTree

# 入力高速化
#input = sys.stdin.readline
# 再帰回数上限
sys.setrecursionlimit(500000)
# よくあるmod
#MOD = 1000000007
MOD = 998244353

def solve():
    # 解答ここから
    H, W = map(int, input().split(' '))
    points = [0, 0]
    cur = (H + W + 1) % 2 # 0: sepa, 1: ryota
    while H > 1 and W > 1:
        if H < W:
            H, W = W, H

        H -= W
        points[cur] += W
        cur ^= 1
    if H < W:
        H, W = W, H
    points[cur] += (H + 1) // 2
    points[cur^1] += (H - (H + 1) // 2)

    if points[0] >= points[1]:
        print("sepa")
    else:
        print("ryota")
if __name__ == '__main__':
    T = int(input())
    for _ in range(T):
        solve()
0