結果
| 問題 |
No.2938 Sigma Sigma Distance Distance Problem
|
| コンテスト | |
| ユーザー |
srjywrdnprkt
|
| 提出日時 | 2024-10-19 20:03:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 398 bytes |
| コンパイル時間 | 2,005 ms |
| コンパイル使用メモリ | 194,692 KB |
| 最終ジャッジ日時 | 2025-02-24 21:41:14 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 TLE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll N, S=0;
cin >> N;
vector<ll> A(N);
for (int i=0; i<N; i++) cin >> A[i];
for (int i=0; i<N; i++){
for (int j=0; j<N; j++){
S += abs(A[i]-A[j]) * abs(i-j);
}
}
cout << S << endl;
return 0;
}
srjywrdnprkt