Submission #367340

# Submission time Handle Problem Language Result Execution time Memory
367340 2021-02-16T22:42:16 Z lookcook Exhibition (JOI19_ho_t2) C++17
50 / 100
1000 ms 10596 KB
#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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:28:23: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for (int i = 0; i < frames.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 6 ms 492 KB Output is correct
21 Correct 2 ms 404 KB Output is correct
22 Correct 11 ms 492 KB Output is correct
23 Correct 11 ms 492 KB Output is correct
24 Correct 6 ms 492 KB Output is correct
25 Correct 6 ms 492 KB Output is correct
26 Correct 7 ms 512 KB Output is correct
27 Correct 11 ms 492 KB Output is correct
28 Correct 11 ms 492 KB Output is correct
29 Correct 6 ms 492 KB Output is correct
30 Correct 6 ms 492 KB Output is correct
31 Correct 5 ms 512 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 4 ms 492 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 7 ms 492 KB Output is correct
37 Correct 7 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 492 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 6 ms 492 KB Output is correct
21 Correct 2 ms 404 KB Output is correct
22 Correct 11 ms 492 KB Output is correct
23 Correct 11 ms 492 KB Output is correct
24 Correct 6 ms 492 KB Output is correct
25 Correct 6 ms 492 KB Output is correct
26 Correct 7 ms 512 KB Output is correct
27 Correct 11 ms 492 KB Output is correct
28 Correct 11 ms 492 KB Output is correct
29 Correct 6 ms 492 KB Output is correct
30 Correct 6 ms 492 KB Output is correct
31 Correct 5 ms 512 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 4 ms 492 KB Output is correct
35 Correct 1 ms 364 KB Output is correct
36 Correct 7 ms 492 KB Output is correct
37 Correct 7 ms 492 KB Output is correct
38 Execution timed out 1096 ms 10596 KB Time limit exceeded
39 Halted 0 ms 0 KB -