結果

問題 No.3795 Circular railway
ユーザー 👑 loop0919
提出日時 2026-11-13 22:36:40
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
RE  
実行時間 -
コード長 231 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 83 ms
コンパイル使用メモリ 64,156 KB
実行使用メモリ 63,644 KB
最終ジャッジ日時 2026-11-13 22:36:50
合計ジャッジ時間 8,510 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other AC * 10 WA * 5 RE * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, Q, S, T, C = [int(s) for s in input().split()]
S -= 1
T -= 1


def dist(s, t):
    return (t - s) % N


for _ in range(N):
    U, V = [int(s) - 1 for s in input().split()]
    print(min(dist(U, V), dist(U, S) + C + dist(T, V)))
0