#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 |
- |