結果
| 問題 |
No.3260 岩井スターグラフ
|
| コンテスト | |
| ユーザー |
まぬお
|
| 提出日時 | 2025-09-06 13:11:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 646 ms / 2,000 ms |
| コード長 | 614 bytes |
| コンパイル時間 | 213 ms |
| コンパイル使用メモリ | 82,232 KB |
| 実行使用メモリ | 78,252 KB |
| 最終ジャッジ日時 | 2025-09-06 13:14:43 |
| 合計ジャッジ時間 | 18,392 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations
from heapq import heappop, heappush
import math, sys
# input = sys.stdin.readline
_int = lambda x: int(x)-1
MOD = 998244353 #10**9+7
INF = 1<<60
Yes, No = "Yes", "No"
X, Y, N = map(int, input().split())
def same(u, v):
if u == 0:
return False
return (u-1)//Y == (v-1)//Y
for _ in range(N):
u, v = map(int, input().split())
if same(u, v):
print(v-u)
elif u == 0:
print((v-1)%Y+1)
else:
print((u-1)%Y+(v-1)%Y+2)
まぬお