Submission #153274

#TimeUsernameProblemLanguageResultExecution timeMemory
153274mhy908Exhibition (JOI19_ho_t2)C++14
100 / 100
81 ms5700 KiB
#include <bits/stdc++.h> #define F first #define S second #define pb push_back #define llinf 8987654321987654321 #define inf 1987654321 using namespace std; typedef long long LL; typedef pair<LL, LL> pll; int n, m; LL frame[100010]; pll pic[100010]; bool poss(int num) { for(int i=1, j=m-num+1; i<=n&&j<=m; i++){ if(pic[i].S<=frame[j])j++; if(j>=m+1)return true; } return false; } int f(int st, int fin) { if(st==fin)return st; int mid=(st+fin)/2+1; if(poss(mid))return f(mid, fin); return f(st, mid-1); } int main() { scanf("%d %d", &n, &m); for(int i=1; i<=n; i++){ scanf("%lld %lld", &pic[i].S, &pic[i].F); } sort(pic+1, pic+n+1); for(int i=1; i<=m; i++){ scanf("%lld", &frame[i]); } sort(frame+1, frame+m+1); printf("%d", f(0, m)); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:30:10: 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:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &pic[i].S, &pic[i].F);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &frame[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...