結果
| 問題 | No.1687 What the Heck? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-29 19:49:07 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 322 bytes |
| 記録 | |
| コンパイル時間 | 1,162 ms |
| コンパイル使用メモリ | 210,692 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-27 19:57:21 |
| 合計ジャッジ時間 | 2,683 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector<int>P(N);
for(int i=0;i<N;i++){
int a;cin>>a;
P[a-1]=i+1;
}
long long ans=0,s=0;
for(int i=0;i<N-1;i++){
s+=P[i];
ans=max(ans,s-P[i+1]);
}
cout<<ans<<'\n';
}