結果
| 問題 | 
                            No.831 都市めぐり
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-05-24 22:03:23 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 721 bytes | 
| コンパイル時間 | 101 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 112,540 KB | 
| 最終ジャッジ日時 | 2024-09-17 10:42:14 | 
| 合計ジャッジ時間 | 5,595 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge6 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 WA * 1 | 
ソースコード
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]
        if i == len_left - 1:
            ans += left[i]*right[i+1]
            ans += right[i]*right[i+1]
            break
        ans += left[i]*right[i+1]
        ans += left[i+1]*right[i]
    print(ans)