結果
| 問題 | No.1687 What the Heck? |
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-09-24 22:15:29 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 358 bytes |
| 記録 | |
| コンパイル時間 | 1,112 ms |
| コンパイル使用メモリ | 181,712 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-26 17:40:33 |
| 合計ジャッジ時間 | 2,225 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
vector<int> a(N);
for(int i=0;i<N;++i){
int input;
cin>>input;
a[input-1]=i+1;
}
long long ans=0;
long long temp=-a[0];
for(int i=0;i<N-1;++i){
temp+=a[i]*2-a[i+1];
ans=max(ans,temp);
}
cout<<ans<<endl;
}
ytft