Submission #99670

#TimeUsernameProblemLanguageResultExecution timeMemory
99670cki86201Exhibition (JOI19_ho_t2)C++11
100 / 100
153 ms1656 KiB
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <stack> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_set> #include <bitset> #include <time.h> #include <limits.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define Fi first #define Se second #define pb(x) push_back(x) #define szz(x) (int)x.size() #define rep(i,n) for(int i=0;i<n;i++) #define all(x) x.begin(),x.end() typedef tuple<int, int, int> t3; int N, M; pii p[100010]; int C[100010]; int X[100010]; int main() { scanf("%d%d", &N, &M); for(int i=1;i<=N;i++) { scanf("%d%d", &p[i].Se, &p[i].Fi); } sort(p+1, p+1+N); for(int i=1;i<=M;i++) scanf("%d", C + i); sort(C+1, C+1+M); reverse(C+1, C+1+M); int low = 0, high = min(N, M), res = -1; while(low <= high) { int mid = (low + high) >> 1; int z = 0; for(int i=1;i<=N;i++) { int val = p[i].Se; int t = (int)(upper_bound(X+1, X+1+z, val) - X); if(C[mid+1-t] < val) continue; if(t == 1+z) ++z; if(z == mid) break; } if(z >= mid) res = mid, low = mid + 1; else high = mid - 1; } printf("%d\n", res); return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:38: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:40:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &p[i].Se, &p[i].Fi);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:43:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;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...