# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1006220 | DangerNoodle7591 | Osumnjičeni (COCI21_osumnjiceni) | C++17 | 1006 ms | 11356 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
//#define int long long int
//#define ll long long
#define pb push_back
#define p push
#define f first
#define s second
#define N 5000
vector<tuple<int,int,int>> v;
int cevap(int l,int r){
int cev=0;
multiset<int> st;
for(int i=0;i<v.size();i++){
int a,b,c;tie(a,b,c)=v[i];
if(c<l||c>r)continue;
auto it=st.upper_bound(-b);
if(it==st.end()){
st.insert(-a);
continue;
}
st.erase(it);
st.insert(-a);
}
return (int)st.size();
}
signed main(){
lalala;
int n;cin>>n;
for(int i=0;i<n;i++){
int a,b;cin>>a>>b;
v.pb({b,a,i+1});
}
sort(v.begin(),v.end());
int q;cin>>q;
while(q--){
int l,r;cin>>l>>r;
cout<<cevap(l,r)<<endl;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |