結果

問題 No.3260 岩井スターグラフ
ユーザー もろこし
提出日時 2025-09-06 13:26:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 621 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 82,644 KB
実行使用メモリ 77,728 KB
最終ジャッジ日時 2025-09-06 13:27:12
合計ジャッジ時間 17,781 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
def ii(): return int(input())
def ist(): return input().split()
def mi(d=0): return map(lambda x:int(x)-d,input().split())
def lmi(d=0): return list(map(lambda x:int(x)-d,input().split()))
INF = float("inf")
def answer(s):
  print(s)
  exit()
################################################
x,y,n = mi()
for _ in range(n):
  u,v = mi()
  if u == 0:
    print((v-1)%y+1)
  else:
    # print((u-1)//y,(v-1)//y,"!")
    if (u-1)//y == (v-1)//y:
      print(v-u)
    else:
      print((u-1)%y+1 + (v-1)%y+1)
0