結果

問題 No.831 都市めぐり
ユーザー kamojirokamojiro
提出日時 2019-05-24 22:10:07
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 636 bytes
コンパイル時間 927 ms
コンパイル使用メモリ 81,524 KB
実行使用メモリ 93,280 KB
最終ジャッジ日時 2023-10-17 12:41:35
合計ジャッジ時間 6,743 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,444 KB
testcase_01 AC 43 ms
53,376 KB
testcase_02 AC 42 ms
55,424 KB
testcase_03 AC 42 ms
53,376 KB
testcase_04 AC 42 ms
55,424 KB
testcase_05 AC 42 ms
55,424 KB
testcase_06 AC 47 ms
59,628 KB
testcase_07 AC 49 ms
61,772 KB
testcase_08 AC 50 ms
61,772 KB
testcase_09 AC 47 ms
61,628 KB
testcase_10 AC 50 ms
61,772 KB
testcase_11 AC 50 ms
61,772 KB
testcase_12 AC 546 ms
70,176 KB
testcase_13 AC 354 ms
70,176 KB
testcase_14 AC 632 ms
70,100 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N = int( input())
if N == 1:
    ans = 0
else:
    ans = 0
    d = deque()
    t = N//2
    if N%2 == 0:
        for i in range(t):
            if i%2 == 0:
                d.appendleft(t-i)
                d.append(t+1+i)
            else:
                d.appendleft(t+1+i)
                d.append(t-i)
    else:
        d.append(t+1)
        for i in range(t):
            if i%2 == 0:
                d.appendleft(t-i)
                d.append(t+i+2)
            else:
                d.appendleft(t+i+2)
                d.append(t-i)
    for i in range(N):
        ans += d[i]*d[(i+1)%N]
print(ans)
0