結果
問題 |
No.1233 割り切れない気持ち
|
ユーザー |
|
提出日時 | 2022-01-28 18:25:21 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 527 bytes |
コンパイル時間 | 1,486 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 109,440 KB |
最終ジャッジ日時 | 2024-12-29 20:17:27 |
合計ジャッジ時間 | 8,506 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 7 WA * 32 |
ソースコード
n = int(input()) A = list(map(int, input().split())) N = max(A) + 10 cnt = [0] * (N + 1) tot = [0] * (N + 1) for a in A: cnt[a] += 1 tot[a] += a for i in range(N): cnt[i + 1] += cnt[i] tot[i + 1] += tot[i] ans = 0 for i in range(1, N + 1): c = cnt[i] - cnt[i - 1] if c == 0: continue ans += tot[i - 1] j = i while j < N: cc = cnt[min(j + i - 1, N)] - cnt[j - 1] tt = tot[min(j + i - 1, N)] - tot[j - 1] ans += tt - cc * j j += i print(ans)