| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 367340 | lookcook | Exhibition (JOI19_ho_t2) | C++17 | 1096 ms | 10596 KiB |
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>
#define int long long
using namespace std;
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
map<pair<int,int>,int> cnt;
vector<int> frames;
for (int i = 0; i < n; i++) {
int s, v;
cin >> s >> v;
cnt[{s,v}]++;
}
for (int i = 0; i < m; i++) {
int c;
cin >> c;
frames.push_back(c);
}
sort(frames.begin(),frames.end());
reverse(frames.begin(),frames.end());
int lstVal = 1e18;
int res = 0;
for (int i = 0; i < frames.size(); i++) {
int c = frames[i];
pair<int,int> best = {-1,-1};
for (pair<pair<int,int>,int> pa : cnt) {
if (pa.first.second <= lstVal && pa.first.first <= c) {
if (pa.first.second>=best.second) best = pa.first;
}
}
if (best.first != -1) {
res++;
lstVal = best.second;
cnt[best]--;
if (cnt[best] == 0) cnt.erase(best);
}
}
cout << res << '\n';
}Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
