답안 #367342

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
367342 2021-02-16T22:48:33 Z lookcook Exhibition (JOI19_ho_t2) C++17
100 / 100
65 ms 6648 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;
    vector<pair<int,int>> vec;
    priority_queue<pair<int,int>> pq;
    for (int i = 0; i < n; i++) {
        int s, v;
        cin >> s >> v;
        pq.push({v,s});
    }
    sort(vec.begin(),vec.end());
    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};
        while (!pq.empty()) {
            pair<int,int> pa = pq.top();
            pq.pop();
            if (pa.second > c || pa.first > lstVal) continue;
            best = pa;
            break;
        }
        if (best.first != -1) {
            res++;
            lstVal = best.first;
        }
    }
    cout << res << '\n';
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:31: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]
   31 |     for (int i = 0; i < frames.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Correct 0 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 1 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
29 Correct 1 ms 364 KB Output is correct
30 Correct 1 ms 364 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 1 ms 364 KB Output is correct
33 Correct 1 ms 364 KB Output is correct
34 Correct 1 ms 364 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 364 KB Output is correct
37 Correct 1 ms 364 KB Output is correct
38 Correct 60 ms 3684 KB Output is correct
39 Correct 60 ms 6648 KB Output is correct
40 Correct 58 ms 6628 KB Output is correct
41 Correct 63 ms 6628 KB Output is correct
42 Correct 62 ms 6628 KB Output is correct
43 Correct 62 ms 6628 KB Output is correct
44 Correct 62 ms 6628 KB Output is correct
45 Correct 63 ms 6628 KB Output is correct
46 Correct 59 ms 6628 KB Output is correct
47 Correct 59 ms 6128 KB Output is correct
48 Correct 55 ms 6116 KB Output is correct
49 Correct 51 ms 5604 KB Output is correct
50 Correct 48 ms 5476 KB Output is correct
51 Correct 62 ms 6628 KB Output is correct
52 Correct 63 ms 6628 KB Output is correct
53 Correct 64 ms 6500 KB Output is correct
54 Correct 55 ms 6628 KB Output is correct
55 Correct 63 ms 6628 KB Output is correct
56 Correct 28 ms 4072 KB Output is correct
57 Correct 28 ms 2412 KB Output is correct
58 Correct 29 ms 4068 KB Output is correct
59 Correct 29 ms 4072 KB Output is correct
60 Correct 21 ms 2408 KB Output is correct
61 Correct 35 ms 3944 KB Output is correct
62 Correct 63 ms 6628 KB Output is correct
63 Correct 62 ms 6628 KB Output is correct
64 Correct 62 ms 6628 KB Output is correct
65 Correct 63 ms 6628 KB Output is correct
66 Correct 64 ms 6628 KB Output is correct
67 Correct 62 ms 6628 KB Output is correct
68 Correct 62 ms 6648 KB Output is correct
69 Correct 63 ms 6628 KB Output is correct
70 Correct 65 ms 6628 KB Output is correct
71 Correct 61 ms 6628 KB Output is correct
72 Correct 63 ms 6648 KB Output is correct
73 Correct 59 ms 6628 KB Output is correct