結果

問題 No.1868 Teleporting Cyanmond
ユーザー shangtian551shangtian551
提出日時 2024-04-22 00:05:48
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 37 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 3,481 ms
コンパイル使用メモリ 128,948 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-04-22 00:05:54
合計ジャッジ時間 5,508 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 30 ms
7,424 KB
testcase_04 AC 22 ms
6,416 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 6 ms
5,376 KB
testcase_07 AC 14 ms
5,376 KB
testcase_08 AC 9 ms
5,376 KB
testcase_09 AC 13 ms
5,376 KB
testcase_10 AC 26 ms
7,040 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 7 ms
5,376 KB
testcase_13 AC 14 ms
5,632 KB
testcase_14 AC 26 ms
7,808 KB
testcase_15 AC 17 ms
6,272 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 7 ms
5,376 KB
testcase_18 AC 29 ms
8,320 KB
testcase_19 AC 29 ms
8,192 KB
testcase_20 AC 27 ms
8,320 KB
testcase_21 AC 27 ms
8,192 KB
testcase_22 AC 29 ms
8,320 KB
testcase_23 AC 37 ms
8,192 KB
testcase_24 AC 37 ms
8,192 KB
testcase_25 AC 37 ms
8,192 KB
testcase_26 AC 36 ms
8,320 KB
testcase_27 AC 36 ms
8,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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