結果

問題 No.1868 Teleporting Cyanmond
コンテスト
ユーザー shangtian551
提出日時 2024-04-22 00:05:48
言語 C++17(clang)
(clang++ 22.1.2 + boost 1.89.0)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 669 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 6,520 ms
コンパイル使用メモリ 141,184 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2026-05-01 09:21:43
合計ジャッジ時間 6,808 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <queue>
#include<vector>
#include<set>
#include<stack>
#include<array>
#include<string>
#include <cassert>
#include <algorithm>
using namespace std;
#define ll long long 
#define endl "\n"
void solved(){
     int n;
     cin>>n;
     vector<int> a(n+1);
     for(int i=1;i<=n-1;i++) cin>>a[i];
     multiset<int> s;
     int l=a[1];
     s.insert(a[1]);
     int ans=1;
     for(int i=2;i<=n-1;i++){
        s.insert(a[i]);
        if(s.size()==l){
           ans++;
           l=*s.rbegin();
        }
     }
     cout<<ans<<endl;
   

}
signed main(){
   
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    solved();
}
0