結果

問題 No.1034 テスターのふっぴーさん
ユーザー roarisroaris
提出日時 2020-04-24 22:14:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 146 ms
コンパイル使用メモリ 82,408 KB
実行使用メモリ 55,772 KB
最終ジャッジ日時 2024-04-23 03:27:13
合計ジャッジ時間 2,352 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
54,296 KB
testcase_01 AC 47 ms
55,364 KB
testcase_02 AC 44 ms
54,176 KB
testcase_03 AC 42 ms
53,928 KB
testcase_04 AC 45 ms
54,976 KB
testcase_05 AC 40 ms
54,420 KB
testcase_06 AC 42 ms
53,616 KB
testcase_07 AC 41 ms
55,456 KB
testcase_08 AC 41 ms
54,280 KB
testcase_09 AC 42 ms
55,240 KB
testcase_10 AC 41 ms
54,188 KB
testcase_11 AC 42 ms
54,112 KB
testcase_12 AC 41 ms
55,560 KB
testcase_13 AC 42 ms
54,268 KB
testcase_14 AC 43 ms
53,684 KB
testcase_15 AC 42 ms
54,060 KB
testcase_16 AC 41 ms
53,540 KB
testcase_17 AC 42 ms
54,620 KB
testcase_18 AC 43 ms
54,360 KB
testcase_19 AC 43 ms
54,692 KB
testcase_20 AC 44 ms
55,388 KB
testcase_21 AC 43 ms
54,184 KB
testcase_22 AC 42 ms
55,392 KB
testcase_23 AC 43 ms
54,492 KB
testcase_24 AC 42 ms
54,184 KB
testcase_25 AC 42 ms
55,772 KB
testcase_26 AC 43 ms
54,848 KB
testcase_27 AC 42 ms
55,176 KB
testcase_28 AC 42 ms
55,488 KB
testcase_29 AC 44 ms
55,220 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

Q = int(input())

for _ in range(Q):
    N, I, J = map(int, input().split())
    a = min(I, N-1-I, J, N-1-J)
    ans = (4*N-4+4*N-4-8*(a-1))*a//2
    
    if I==a:
        ans += J-a
    elif J==N-1-a:
        ans += N-1-a-a+I-a
    elif I==N-1-a:
        ans += 2*(N-1-a-a)+N-1-a-J
    else:
        ans += 3*(N-1-a-a)+N-1-a-I
    
    print(ans)
0