結果
| 問題 |
No.1034 テスターのふっぴーさん
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:20:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,204 bytes |
| コンパイル時間 | 563 ms |
| コンパイル使用メモリ | 81,860 KB |
| 実行使用メモリ | 54,688 KB |
| 最終ジャッジ日時 | 2025-03-20 21:21:46 |
| 合計ジャッジ時間 | 2,521 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 30 |
ソースコード
def compute_sum(N, k):
if k == 0:
return 0
sum_part1 = 0
max_i_part1 = (N - 2) // 2
a = min(k - 1, max_i_part1)
if a >= 0:
sum_part1 = 4 * a * (N - a)
sum_part2 = 0
if N % 2 == 1:
m = (N - 1) // 2
if k > m:
sum_part2 = 1
return sum_part1 + sum_part2
def get_time(N, I, J):
k = min(I, J, (N-1 - I), (N-1 - J))
L = N - 2 * k
if L == 1:
sum_total = compute_sum(N, k)
return sum_total
sum_total = compute_sum(N, k)
i, j = I, J
right = (i == k) and (k <= j < (k + L))
if right:
offset = j - k
return sum_total + offset
down = (j == (k + L -1)) and ( (k +1) <= i < (k + L))
if down:
offset = L + (i - (k +1))
return sum_total + offset
left = (i == (k + L -1)) and (k <= j <= (k + L -2))
if left:
offset = L + (L -1) + ( (k + L -2) - j )
return sum_total + offset
up = (j == k) and ( (k +1) <= i <= (k + L -2))
offset = L + (L-1) + (L-1) + (i - (k +1))
return sum_total + offset
Q = int(input())
for _ in range(Q):
N, I, J = map(int, input().split())
print(get_time(N, I, J))
lam6er