This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
#define pb push_back
#define f first
#define s second
int main() {
int N, M;
cin >> N >> M;
vector<pi> pictures;
for (int i = 0; i < N; i++) {
int s, v;
cin >> s >> v;
pictures.pb({v, s});
}
vi frames;
for (int i = 0; i < M; i++) {
int s;
cin >> s;
frames.pb(s);
}
sort(pictures.begin(), pictures.end());
sort(frames.begin(), frames.end());
reverse(pictures.begin(), pictures.end());
reverse(frames.begin(), frames.end());
int nP = 0, ans = 0;
for (int i = 0; i < frames.size(); i++) {
while (nP < pictures.size() && pictures[nP].s > frames[i]) {
nP++;
}
if (nP == pictures.size()) {
break;
}
ans++;
nP++;
}
cout << ans << endl;
}
Compilation message (stderr)
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < frames.size(); i++) {
~~^~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:42:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while (nP < pictures.size() && pictures[nP].s > frames[i]) {
~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:45:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (nP == pictures.size()) {
~~~^~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |