結果
問題 | No.2335 Jump |
ユーザー |
![]() |
提出日時 | 2023-06-02 21:27:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 576 bytes |
コンパイル時間 | 1,759 ms |
コンパイル使用メモリ | 200,120 KB |
最終ジャッジ日時 | 2025-02-13 17:41:50 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll=long long;using ld=long double;ld pie=3.141592653589793;ll inf=2000000000000000000;ll mod=998244353;int main(){ll n;cin >> n;vector<ll>a(n);for (ll i = 0; i < n; i++){cin >> a[i];}vector<ll>x;x.push_back(n);for (ll i = 0; i < n; i++){if (a[i]>n){x.push_back(a[i]);}}sort(x.begin(),x.end());ll ans=0;for (ll i = 1; i < x.size(); i++){ans+=x[i]-x[i-1];}cout << ans << endl;}