結果
問題 | No.831 都市めぐり |
ユーザー |
|
提出日時 | 2019-05-24 22:05:11 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 1,119 ms / 2,000 ms |
コード長 | 785 bytes |
コンパイル時間 | 88 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 112,656 KB |
最終ジャッジ日時 | 2024-09-17 10:42:41 |
合計ジャッジ時間 | 5,819 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
N = int(input())left = N//2right = N - leftA = [i+1 for i in range(N)]left = A[:N//2]right = sorted(A[- N//2:], reverse=True)ans = 0len_left = len(left)if len_left == len(right):for i in range(len_left):if i == 0:ans += left[i]*right[i]if i == len_left - 1:ans += left[i]*right[i]breakif 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]if i == len_left - 1:ans += left[i]*right[i+1]ans += right[i]*right[i+1]breakans += left[i]*right[i+1]ans += left[i+1]*right[i]print(ans)