Submission #207925

#TimeUsernameProblemLanguageResultExecution timeMemory
207925DodgeBallManExhibition (JOI19_ho_t2)C++14
100 / 100
94 ms5012 KiB
#include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; int n, m, ans, now; vector<int> fra; vector<pii> pic; int main() { scanf("%d %d",&n,&m); for( int i = 0, a, b ; i < n ; i++ ) { scanf("%d %d",&a,&b); pic.emplace_back( pii( b, a ) ); } for( int i = 0, a ; i < m ; i++ ) { scanf("%d",&a); fra.emplace_back( a ); } sort( pic.begin(), pic.end(), greater<pii>() ), sort( fra.begin(), fra.end(), greater<int>() ); for( int i = 0 ; i < m ; i++ ) { while( pic[now].y > fra[i] && now < n ) now++; if( now == n ) break; ans++, now++; } printf("%d",ans); return 0; }

Compilation message (stderr)

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