Submission #1105406

#TimeUsernameProblemLanguageResultExecution timeMemory
1105406salmonExhibition (JOI19_ho_t2)C++14
100 / 100
53 ms5052 KiB
#include <bits/stdc++.h> using namespace std; int N,M; vector<pair<int,int>> p; int h1,h2; vector<int> v; int main(){ scanf(" %d",&N); scanf(" %d",&M); for(int i = 0; i < N; i++){ scanf(" %d",&h1); scanf(" %d",&h2); p.push_back({h2,h1}); } for(int i = 0; i < M; i++){ scanf(" %d",&h1); v.push_back(h1); } sort(p.begin(),p.end(), greater<pair<int,int>>()); sort(v.begin(),v.end(),greater<int>()); int num = 0; for(int i = 0; i < N; i++){ if(p[i].second <= v[num]){ num++; } if(num == M) break; } printf("%d",num); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf(" %d",&N);
      |     ~~~~~^~~~~~~~~~
joi2019_ho_t2.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf(" %d",&M);
      |     ~~~~~^~~~~~~~~~
joi2019_ho_t2.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf(" %d",&h1);
      |         ~~~~~^~~~~~~~~~~
joi2019_ho_t2.cpp:16:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |         scanf(" %d",&h2);
      |         ~~~~~^~~~~~~~~~~
joi2019_ho_t2.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         scanf(" %d",&h1);
      |         ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...