結果

問題 No.1034 テスターのふっぴーさん
ユーザー ryo_nryo_n
提出日時 2020-04-24 21:52:09
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 808 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 17,696 KB
最終ジャッジ日時 2024-04-23 03:12:01
合計ジャッジ時間 4,567 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
17,696 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,624 KB
testcase_06 AC 30 ms
10,624 KB
testcase_07 AC 34 ms
10,880 KB
testcase_08 AC 30 ms
10,624 KB
testcase_09 AC 30 ms
10,624 KB
testcase_10 AC 32 ms
10,624 KB
testcase_11 AC 31 ms
10,752 KB
testcase_12 AC 31 ms
10,624 KB
testcase_13 AC 30 ms
10,752 KB
testcase_14 AC 31 ms
10,752 KB
testcase_15 AC 31 ms
10,624 KB
testcase_16 AC 30 ms
10,624 KB
testcase_17 AC 31 ms
10,624 KB
testcase_18 AC 32 ms
10,624 KB
testcase_19 AC 31 ms
10,752 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