結果
| 問題 |
No.1687 What the Heck?
|
| コンテスト | |
| ユーザー |
ytft
|
| 提出日時 | 2021-09-24 22:15:29 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 358 bytes |
| コンパイル時間 | 1,464 ms |
| コンパイル使用メモリ | 168,020 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-05 10:46:17 |
| 合計ジャッジ時間 | 3,032 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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