結果
問題 | No.2938 Sigma Sigma Distance Distance Problem |
ユーザー |
|
提出日時 | 2025-02-21 16:42:17 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 347 bytes |
コンパイル時間 | 3,254 ms |
コンパイル使用メモリ | 275,172 KB |
実行使用メモリ | 13,636 KB |
最終ジャッジ日時 | 2025-02-21 16:42:25 |
合計ジャッジ時間 | 7,678 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 TLE * 1 |
ソースコード
#include <bits/stdc++.h> int main() { int n; std::cin >> n; std::vector<int> a(n + 1); for (int i = 1; i <= n; ++i) std::cin >> a[i]; int res = 0; for (int i = 1; i <= n; ++i) for (int j = 1; j <= n; ++j) res += std::abs(j - i) * std::abs(a[i] - a[j]); std::cout << res << "\n"; return 0; }