제출 #371037

#제출 시각아이디문제언어결과실행 시간메모리
371037peijarExhibition (JOI19_ho_t2)C++17
100 / 100
59 ms4460 KiB
#include <bits/stdc++.h> #define SZ(v) ((int)(v).size()) using namespace std; using ll = long long; template<typename... Args> void read(Args&... args) { ((cin >> args), ...); } template<typename T> void read(vector<T> &vec) { for (auto &v : vec) read(v); } void write() {} template<typename H, typename... T> void write(const H &h, const T&... t) { cout << h; if (sizeof...(t)) {cout << ' '; write(t...);} } template<typename T> void write(const vector<T> &vec) { if (SZ(vec) == 0) return; write(vec[0]); for (int i(1); i < SZ(vec); ++i) {cout << ' '; write(vec[i]);} } template<typename... Args> void writeln(Args... args) { write(args...); cout << '\n'; } int main(void) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int nbPhotos, nbCadres; read(nbPhotos, nbCadres); vector<pair<int, int>> photos(nbPhotos); for (auto &[taille, valeur] : photos) read(taille, valeur); sort(photos.begin(), photos.end(), [](pair<int, int> a, pair<int, int> b) { if (a.second == b.second) return a.first > b.first; return a.second > b.second; }); vector<int> cadres(nbCadres); read(cadres); sort(cadres.rbegin(), cadres.rend()); int sol(0); int deb(0); for (int i(0); i < nbCadres; ++i) { while (deb < nbPhotos and photos[deb].first > cadres[i]) ++deb; if (deb == nbPhotos) break; sol++; ++deb; } writeln(sol); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...