結果
| 問題 |
No.2938 Sigma Sigma Distance Distance Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-18 21:33:46 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 725 bytes |
| コンパイル時間 | 2,470 ms |
| コンパイル使用メモリ | 139,848 KB |
| 実行使用メモリ | 13,772 KB |
| 最終ジャッジ日時 | 2024-10-18 22:21:54 |
| 合計ジャッジ時間 | 63,172 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 TLE * 20 |
ソースコード
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#ifdef local
#include <C++/core/io/debug_print.hpp>
#else
#define dump(...) void(0);
#endif
#include <iostream>
#include <ranges>
#include <valarray>
namespace man {
}
int main() {
std::cin.tie(nullptr) -> sync_with_stdio(false);
using namespace std::views;
int n;
std::cin >> n;
std::valarray<int> a(n);
for(auto &e: a) {
std::cin >> e;
}
int ans = 0;
for(const auto i: iota(0, n)) {
for(const auto j: iota(0, n)) {
ans += std::abs(i - j) * std::abs(a[i] - a[j]);
}
}
std::cout << ans << '\n';
}