結果

問題 No.1687 What the Heck?
ユーザー atjh16atjh16
提出日時 2021-09-25 14:05:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 366 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 198,116 KB
実行使用メモリ 6,636 KB
最終ジャッジ日時 2023-09-18 23:01:21
合計ジャッジ時間 3,720 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 21 ms
4,452 KB
testcase_08 AC 30 ms
4,920 KB
testcase_09 AC 21 ms
4,452 KB
testcase_10 AC 14 ms
4,380 KB
testcase_11 AC 16 ms
4,380 KB
testcase_12 AC 65 ms
6,512 KB
testcase_13 AC 65 ms
6,516 KB
testcase_14 AC 66 ms
6,460 KB
testcase_15 AC 66 ms
6,528 KB
testcase_16 AC 65 ms
6,408 KB
testcase_17 AC 5 ms
4,384 KB
testcase_18 AC 66 ms
6,636 KB
testcase_19 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long n, p, m = 0;
long long u[200001], v[200001];

int main(){
    cin >> n;
        
    for(long long i = 0; i < n; i++){
        cin >> p;
        u[p] = i + 1;
    }
    
    for(long long i = 1; i < n; i++){
        v[i] = v[i - 1] + u[i];
        m = max(m, v[i] - u[i + 1]);
    }

    cout << m << endl;
}
0