이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |