結果
| 問題 |
No.1687 What the Heck?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-25 00:03:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 526 bytes |
| コンパイル時間 | 1,591 ms |
| コンパイル使用メモリ | 176,208 KB |
| 実行使用メモリ | 8,064 KB |
| 最終ジャッジ日時 | 2024-07-05 11:39:58 |
| 合計ジャッジ時間 | 3,078 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 9 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
int N,M;
cin>>N;
vector<pair<int,ll>> p(N);
for(int i=0;i<N;i++){
int P;
cin>>P;
p[i]={P,i+1};
}
sort(p.begin(),p.end());
vector<int> t(N);
for(int i=0;i<N;i++){
t[i]=p[i].second;
}
ll ans=0;
vector<int> sum(N);
partial_sum(t.begin(),t.end(),sum.begin());
for(int i=1;i<N;i++){
ans=max(ans,sum[i-1]-p[i].second);
}
cout<<ans<<endl;
return 0;
}