Submission #705746

#TimeUsernameProblemLanguageResultExecution timeMemory
705746myrcellaExhibition (JOI19_ho_t2)C++17
100 / 100
63 ms4484 KiB
//by szh #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl #define pq priority_queue #define inf 0x3f #define rep(i,a,b) for (int i=a;i<(b);i++) #define MP make_pair #define SZ(x) (int(x.size())) #define ll long long #define mod 1000000007 #define ALL(x) x.begin(),x.end() void inc(int &a,int b) {a=(a+b)%mod;} void dec(int &a,int b) {a=(a-b+mod)%mod;} int lowbit(int x) {return x&(-x);} ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;} const int maxn = 1e5+10; int n,m; pii pict[maxn]; int frame[maxn]; bool check(int cnt) { int cur = m-cnt; int p=0; while (cur<m) { while (p<n and pict[p].se>frame[cur]) p++; if (p==n) return false; cur++; p++; } return true; } int main() { // freopen("input.txt","r",stdin); std::ios::sync_with_stdio(false);cin.tie(0); cin>>n>>m; rep(i,0,n) cin>>pict[i].se>>pict[i].fi; sort(pict,pict+n); rep(i,0,m) cin>>frame[i]; sort(frame,frame+m); int l = 0,r = min(n,m); while (l<r) { int mid=l+r+1>>1; if (check(mid)) l = mid; else r = mid-1; } cout<<l; return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:52:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   52 |   int mid=l+r+1>>1;
      |           ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...