結果

問題 No.1034 テスターのふっぴーさん
ユーザー ryo_nryo_n
提出日時 2020-04-24 21:52:24
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 808 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 82,788 KB
実行使用メモリ 66,144 KB
最終ジャッジ日時 2024-04-23 03:12:13
合計ジャッジ時間 4,629 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
59,404 KB
testcase_01 AC 39 ms
53,992 KB
testcase_02 AC 38 ms
53,652 KB
testcase_03 AC 37 ms
53,492 KB
testcase_04 AC 37 ms
53,560 KB
testcase_05 AC 37 ms
52,136 KB
testcase_06 AC 38 ms
53,496 KB
testcase_07 AC 37 ms
52,196 KB
testcase_08 AC 37 ms
52,744 KB
testcase_09 AC 37 ms
53,836 KB
testcase_10 AC 38 ms
52,344 KB
testcase_11 AC 37 ms
52,824 KB
testcase_12 AC 37 ms
54,128 KB
testcase_13 AC 37 ms
52,692 KB
testcase_14 AC 37 ms
53,360 KB
testcase_15 AC 37 ms
53,192 KB
testcase_16 AC 38 ms
53,956 KB
testcase_17 AC 39 ms
52,068 KB
testcase_18 AC 41 ms
58,284 KB
testcase_19 AC 37 ms
53,500 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    Q = int(input())
    NIJ = [[int(x) for x in input().split()] for _ in range(Q)]
    for n, i, j in NIJ:
        c = 0
        for k in range(n // 2 + 1):
            if i == 0 + k:
                print(c + j - k)
                break
            elif j == n - 1 - k:
                print(c + n - 2 * k - 1 + i - k)
                break
            elif i == n - 1 - k:
                print(c + 2 * (n - 2 * k) - 2 + (n - j - 1) - k)
                break
            elif j == 0 + k or j == n - 1 - k:
                print(c + 3 * (n - 2 * k) - 3 + (n - i - 1) - k)
                break
            else:
                c += (n - 2 * k) * 4 - 4
                continue


if __name__ == '__main__':
    main()
0