結果

問題 No.3795 Circular railway
ユーザー kidodesu
提出日時 2026-11-13 22:34:02
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 638 ms / 2,000 ms
+ 92µs
コード長 223 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 96 ms
コンパイル使用メモリ 64,416 KB
実行使用メモリ 60,580 KB
最終ジャッジ日時 2026-11-13 22:34:21
合計ジャッジ時間 8,252 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def main():
    n, q, s, t, c = list(map(int, input().split()))
    s, t = s-1, t-1
    for _ in range(q):
        u, v = list(map(lambda x: int(x)-1, input().split()))
        print(min((v-u)%n, (s-u)%n+(v-t)%n+c))

main()
0