結果

問題 No.3260 岩井スターグラフ
コンテスト
ユーザー はるはる
提出日時 2025-09-06 13:19:16
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 349 ms / 2,000 ms
+ 244µs
コード長 336 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 243 ms
コンパイル使用メモリ 95,840 KB
実行使用メモリ 85,248 KB
最終ジャッジ日時 2026-07-14 18:47:42
合計ジャッジ時間 12,136 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

X,Y,N=map(int,input().split())
for i in range(N):
    U,V=map(int,input().split())
    if U==0 and V==0:
        print(0)
    elif U==0:
        print((V-1)%Y+1)
    elif V==0:
        print((U-1)%Y+1)
    #同じ腕の中なら単に差分
    elif (U-1)//Y==(V-1)//Y:
        print(abs(U-V))
    else:
        print((U-1)%Y+(V-1)%Y+2)
0