結果
問題 |
No.1297 銅像
|
ユーザー |
![]() |
提出日時 | 2025-06-12 16:31:32 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 722 bytes |
コンパイル時間 | 199 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 124,960 KB |
最終ジャッジ日時 | 2025-06-12 16:31:48 |
合計ジャッジ時間 | 5,419 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 WA * 5 TLE * 1 -- * 13 |
ソースコード
def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) idx += 1 C = int(input[idx]) idx +=1 workers = [] for i in range(N): a = int(input[idx]) b = int(input[idx+1]) idx +=2 workers.append( (a, b) ) min_total = float('inf') for i in range(N): a_i, b_i = workers[i] total = b_i total += a_i * N cost = 0 for j in range(1, N+1): distance = abs(j - (i+1)) # i+1是岛的编号,从1到N cost += distance * C total += cost if total < min_total: min_total = total print(min_total) if __name__ == '__main__': main()