結果
問題 |
No.3260 岩井スターグラフ
|
ユーザー |
![]() |
提出日時 | 2025-09-06 13:05:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 342 ms / 2,000 ms |
コード長 | 963 bytes |
コンパイル時間 | 222 ms |
コンパイル使用メモリ | 82,568 KB |
実行使用メモリ | 95,264 KB |
最終ジャッジ日時 | 2025-09-06 13:05:40 |
合計ジャッジ時間 | 11,255 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
from heapq import heappop, heappush, heapify from bisect import bisect #from sortedcontainers import SortedList from collections import deque, defaultdict from math import floor, ceil, isqrt, comb from sys import stdin, setrecursionlimit #setrecursionlimit(10**7) intin = lambda: int(stdin.readline()) strin = lambda: stdin.readline().rstrip() listin = lambda: list(map(int, stdin.readline().split())) tuplein = lambda m: [tuple(map(lambda x: int(x) if x.isdigit() or (len(x) > 1 and x[0] == "-" and x[1:].isdigit()) else x, stdin.readline().split())) for _ in range(m)] gridin = lambda m: [list(map(int, stdin.readline().split())) for _ in range(m)] strgridin = lambda h: [stdin.readline().rstrip() for _ in range(h)] mapin = lambda: map(int, stdin.readline().split()) X, Y, N = mapin() UV = tuplein(N) for u, v in UV: if u == 0: print((v-1)%Y+1) elif (u - 1) // Y == (v - 1) // Y: print(v - u) else: print((v-1)%Y+(u-1)%Y+2)