Submission #133208

#TimeUsernameProblemLanguageResultExecution timeMemory
133208dantoh000Exhibition (JOI19_ho_t2)C++14
100 / 100
85 ms3708 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; bool cmp(ii a, ii b){ if (a.second != b.second) return a.second<b.second; else return a.first<b.first; } int main(){ int n,m; scanf("%d%d",&n,&m); ii a[n]; for (int i = 0; i < n; i++){ scanf("%d%d",&a[i].first,&a[i].second); } int b[m]; sort(a,a+n,cmp); for (int i =0 ; i<m; i++) scanf("%d",&b[i]); sort(b,b+m); int ans = 0; for (int i = n-1; i >= 0 && ans < m; i--){ //printf("%d %d\n",b[m-ans-1],a[i].first); if (a[i].first <= b[m-ans-1]){ ans++; } } printf("%d",ans); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:10: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:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&a[i].first,&a[i].second);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:17:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for (int i =0 ; i<m; i++) scanf("%d",&b[i]);
                               ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...