Submission #152995

#TimeUsernameProblemLanguageResultExecution timeMemory
152995junodeveloperExhibition (JOI19_ho_t2)C++14
100 / 100
132 ms4600 KiB
#include <bits/stdc++.h> #define sz(x) ((int)x.size()) #define all(x) (x).begin(), (x).end() #define fi first #define se second using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; int n,m,C[100010]; pii a[100010]; bool F(int x) { int i,j=m-x; for(i=0;i<n;i++) { if(j==m) break; if(a[i].se<=C[j]) j++; } return j==m; } int main() { scanf("%d%d",&n,&m); int i; for(i=0;i<n;i++) scanf("%d%d",&a[i].se,&a[i].fi); for(i=0;i<m;i++) scanf("%d",C+i); sort(a,a+n); sort(C,C+m); int lo=0,hi=min(n,m); while(lo<hi) { int mid=(lo+hi+1)/2; if(F(mid)) lo=mid; else hi=mid-1; } printf("%d",lo); return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t2.cpp:24:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<n;i++) scanf("%d%d",&a[i].se,&a[i].fi);
                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:25:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<m;i++) scanf("%d",C+i);
                   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...