結果

問題 No.831 都市めぐり
ユーザー kamojirokamojiro
提出日時 2019-05-24 22:09:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 636 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 11,928 KB
実行使用メモリ 47,736 KB
最終ジャッジ日時 2023-10-17 12:41:00
合計ジャッジ時間 5,457 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
17,120 KB
testcase_01 AC 31 ms
10,092 KB
testcase_02 AC 28 ms
10,092 KB
testcase_03 AC 28 ms
10,092 KB
testcase_04 AC 28 ms
10,092 KB
testcase_05 AC 29 ms
10,092 KB
testcase_06 AC 28 ms
10,120 KB
testcase_07 AC 30 ms
10,212 KB
testcase_08 AC 34 ms
10,388 KB
testcase_09 AC 28 ms
10,136 KB
testcase_10 AC 33 ms
10,416 KB
testcase_11 AC 33 ms
10,372 KB
testcase_12 AC 446 ms
13,876 KB
testcase_13 AC 295 ms
13,084 KB
testcase_14 AC 448 ms
13,876 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