Submission #995633

#TimeUsernameProblemLanguageResultExecution timeMemory
995633rsinventorExhibition (JOI19_ho_t2)C++17
100 / 100
46 ms1628 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<bool> vb; typedef vector <string> vs; typedef vector<char> vc; typedef pair<int, int> pii; typedef vector <pii> vpii; #define all(a) (a).begin(), (a).end() #define pb push_back #define ins insert #define endl "\n" bool cmp(pii a, pii b) { if(a.second==b.second) { return a.first>b.first; } return a.second>b.second; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vpii pics(n); for(int i = 0; i < n; i++) { cin >> pics[i].first >> pics[i].second; } vi frames(m); for(int i = 0; i < m; i++) { cin >> frames[i]; } sort(all(frames), greater<>()); sort(all(pics), cmp); int i = 0; int j = 0; int ans = 0; while(i<pics.size() && j<frames.size()) { if(pics[i].first<=frames[j]) { i++; j++; ans++; } else { i++; } } cout << ans << endl; return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:44:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     while(i<pics.size() && j<frames.size()) {
      |           ~^~~~~~~~~~~~
joi2019_ho_t2.cpp:44:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |     while(i<pics.size() && j<frames.size()) {
      |                            ~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...