/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 484.0 KiB
#2 Wrong Answer 2ms 532.0 KiB
#3 Accepted 3ms 320.0 KiB
#4 Accepted 4ms 544.0 KiB
#5 Wrong Answer 4ms 532.0 KiB

Code

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pld;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpll;
typedef vector<pld> vpld;
 
#define int ll
#define all(it) it.begin(),it.end()
#define ord_set(T) tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> 
  


void work(){
    int n;
    cin >> n;
    vll v(n);
    for (auto &c : v) cin >> c;

    ord_set(pll) r,l;

    for (int i=0;i<n;i++) r.insert({v[i],i});

    int res = 0;
    for (int i=0;i<n;i++){
        l.insert({v[i],i});
        if (l.order_of_key({v[i],n+1}) >= v[i] && r.size() - r.order_of_key({v[i],-1}) >= v[i]) res++;
        r.erase({v[i],i});
    }

    cout << res << '\n';
}


int32_t main(){
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);

    work();
    
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1184 The Curious Kid and the Number Game
Language
C++17 (G++ 13.2.0)
Submit At
2025-04-06 22:34:03
Judged At
2025-04-06 22:34:03
Judged By
Score
3
Total Time
4ms
Peak Memory
544.0 KiB