Submission #698040

#TimeUsernameProblemLanguageResultExecution timeMemory
698040Sandarach151Exhibition (JOI19_ho_t2)C++17
100 / 100
47 ms5616 KiB
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m; cin >> n >> m; pair<int, int> pic[n]; int fram[m]; for(int i=0; i<n; i++){ cin >> pic[i].second >> pic[i].first; } sort(pic, pic+n); for(int i=0; i<m; i++){ cin >> fram[i]; } sort(fram, fram+m); stack<pair<int, int> > pics; stack<int> frames; for(int i=0; i<n; i++){ pics.push(pic[i]); } for(int i=0; i<m; i++){ frames.push(fram[i]); } int picscnt = 0; while(!pics.empty() && !frames.empty()){ if(pics.top().second<=frames.top()){ picscnt++; pics.pop(); frames.pop(); } else{ pics.pop(); } } cout << picscnt << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...