Submission #701665

#TimeUsernameProblemLanguageResultExecution timeMemory
701665vjudge1Exhibition (JOI19_ho_t2)C++17
100 / 100
59 ms6768 KiB
#include <bits/stdc++.h> #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); #define int long long #define inf ((int)1e18) #define N 200005 using namespace std; vector <pair<int,int> > arr; vector <int> brr; int32_t main(){ fast int n, m; cin>>n>>m; for(int i=0; i<n; i++){ int a, b; cin>>a>>b; arr.push_back({b, a}); } for(int i=0; i<m; i++){ int a; cin>>a; brr.push_back(a); } sort(arr.begin(), arr.end()); sort(brr.begin(), brr.end()); reverse(arr.begin(), arr.end()); reverse(brr.begin(), brr.end()); int ans=0, l=0, r=0; while(l < arr.size() and r < brr.size()){ int size=arr[l].second, frame=brr[r]; if(size <= frame){ //cout<<size<<" "<<frame<<"\n"; ans++; l++; r++; } else{ l++; } } cout<<ans; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int32_t main()':
joi2019_ho_t2.cpp:29:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  while(l < arr.size() and r < brr.size()){
      |        ~~^~~~~~~~~~~~
joi2019_ho_t2.cpp:29:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |  while(l < arr.size() and r < brr.size()){
      |                           ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...