Submission #851497

# Submission time Handle Problem Language Result Execution time Memory
851497 2023-09-20T02:25:11 Z owoovo Passport (JOI23_passport) C++14
0 / 100
2000 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
int bit[200010],n,qu;
void mo(int pos,int x){
    while(pos<=n){
        bit[pos]=max(bit[pos],x);
        pos+=pos&(-pos);
    }
    return;
}
int q(int pos){
    int ans=0;
    while(pos){
        ans=max(ans,bit[pos]);
        pos+=pos&(-pos);
    }
    return ans;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        int a,b;
        cin>>a>>b;
        mo(i,b);
    }
    cin>>qu;
    int ans=0,now=1;
    while(now!=n){
        ans++;
        now=q(now);
    }
    cout<<ans<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2035 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2029 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2029 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2029 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2035 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -