結果
| 問題 |
No.831 都市めぐり
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-05-24 21:59:57 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 725 bytes |
| コンパイル時間 | 126 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 112,668 KB |
| 最終ジャッジ日時 | 2024-09-17 10:39:55 |
| 合計ジャッジ時間 | 5,639 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 10 WA * 8 |
ソースコード
N = int(input())
left = N//2
right = N - left
A = [i+1 for i in range(N)]
left = A[:N//2]
right = sorted(A[- N//2:], reverse=True)
ans = 0
len_left = len(left)
if len_left == len(right):
for i in range(len_left):
if i == 0 or i == len_left - 1:
ans += left[i]*right[i]
if i != len_left - 1:
ans += left[i]*right[i+1]
ans += left[i+1]*right[i]
print(ans)
else:
for i in range(len_left):
if i == 0:
ans += left[0]*right[0]
elif i == len_left - 1:
ans += left[i]*right[i+1]
ans += right[i]*right[i+1]
else:
ans += left[i]*right[i+1]
ans += left[i+1]*right[i]
print(ans)