結果
| 問題 |
No.2938 Sigma Sigma Distance Distance Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-18 21:26:42 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 303 bytes |
| コンパイル時間 | 2,060 ms |
| コンパイル使用メモリ | 193,288 KB |
| 最終ジャッジ日時 | 2025-02-24 20:25:50 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 RE * 1 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
int N;cin>>N;
vector<int>A(N);for(int i=0;i<N;++i)cin>>A[i];
assert(N<=100);
int ans=0;
for(int i=0;i<N;++i){
for(int j=0;j<N;++j){
ans+=abs(i-j)*abs(A[i]-A[j]);
}
}
cout<<ans<<endl;
}