Submission #884824

#TimeUsernameProblemLanguageResultExecution timeMemory
884824KezzyBlueExhibition (JOI19_ho_t2)C++14
0 / 100
1 ms2476 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll n,q; struct dt{ ll s,v; }; ll b[1000006],d,maxs=0; bool cmp(dt x,dt y) { if(x.v<y.v)return true; if(x.v==y.v) { return x.s<y.s; } return false; } dt a[1000006]; void tinh(ll x,ll y,ll z) { if(y>n||x>q)return; if(a[y].s<=b[x]&&a[y].v>=z) { ll t=z; z=a[y].v; d++; maxs=max(maxs,d); //cout<<a[y].s<<" "<<b[x]<<"\n"; tinh(x+1,y+1,z); d--; z=t; } if(a[y].v<z) tinh(x,y+1,z); if(a[y].s>b[x]) tinh(x+1,y,z); } int main() { cin>>n>>q; for(ll i=1;i<=n;i++) cin>>a[i].s>>a[i].v; sort(a+1,a+n+1,cmp); for(ll i=1;i<=q;i++) cin>>b[i]; sort(b+1,b+q+1); for(ll i=1;i<=n;i++) tinh(1,i,0); cout<<maxs; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...