結果

問題 No.1034 テスターのふっぴーさん
ユーザー roarisroaris
提出日時 2020-04-24 22:14:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 93 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 71,888 KB
最終ジャッジ日時 2023-08-05 05:10:43
合計ジャッジ時間 4,209 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,748 KB
testcase_01 AC 90 ms
71,460 KB
testcase_02 AC 90 ms
71,688 KB
testcase_03 AC 92 ms
71,436 KB
testcase_04 AC 91 ms
71,864 KB
testcase_05 AC 91 ms
71,752 KB
testcase_06 AC 91 ms
71,584 KB
testcase_07 AC 91 ms
71,796 KB
testcase_08 AC 91 ms
71,772 KB
testcase_09 AC 92 ms
71,456 KB
testcase_10 AC 89 ms
71,740 KB
testcase_11 AC 90 ms
71,436 KB
testcase_12 AC 93 ms
71,676 KB
testcase_13 AC 89 ms
71,796 KB
testcase_14 AC 91 ms
71,680 KB
testcase_15 AC 91 ms
71,708 KB
testcase_16 AC 90 ms
71,888 KB
testcase_17 AC 89 ms
71,720 KB
testcase_18 AC 90 ms
71,804 KB
testcase_19 AC 89 ms
71,584 KB
testcase_20 AC 93 ms
71,604 KB
testcase_21 AC 92 ms
71,668 KB
testcase_22 AC 92 ms
71,640 KB
testcase_23 AC 91 ms
71,624 KB
testcase_24 AC 90 ms
71,748 KB
testcase_25 AC 91 ms
71,464 KB
testcase_26 AC 93 ms
71,812 KB
testcase_27 AC 93 ms
71,708 KB
testcase_28 AC 91 ms
71,748 KB
testcase_29 AC 93 ms
71,716 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