답안 #878805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878805 2023-11-25T08:53:04 Z frostray8653 Exhibition (JOI19_ho_t2) C++17
100 / 100
42 ms 3952 KB
#include <bits/stdc++.h>
#define int long long
#define IO ios::sync_with_stdio(0), cin.tie(0)
#define FOR(i, a, b) for (int i = a, I = b; i <= I; i++)
using namespace std;
using pii = pair<int, int>;
void dbg() {;}
template<class T, class ...U>
void dbg(T a, U ...b) { cout << a << " "; dbg(b...); }
void ent() { cout << "\n"; }

const int N = 100005;
pii a[N];
int c[N];

signed main() {
    IO;

    int n, m;
    cin >> n >> m;
    FOR(i, 0, n - 1) cin >> a[i].first >> a[i].second;
    FOR(i, 0, m - 1) cin >> c[i];
    sort(a, a + n, [&] (pii p, pii q) {
        if (p.second != q.second)
            return p.second > q.second;
        return p.first > q.first;
    });
    sort(c, c + m, greater<int>());
    vector<int> tmp;
    FOR(i, 0, n - 1) {
        int x = tmp.size();
        if (x < m && a[i].first <= c[x])
            tmp.push_back(a[i].second);
    }
    cout << tmp.size() << "\n";
    // for (int i : tmp) dbg(i);

    return 0;
}
/*
4 3
100 3
15 4
8 2
7 3
9 8 7
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2392 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2392 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2392 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2392 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 2392 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2648 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 0 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 0 ms 2396 KB Output is correct
19 Correct 0 ms 2396 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2392 KB Output is correct
24 Correct 1 ms 2392 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2392 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2392 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2396 KB Output is correct
32 Correct 1 ms 2396 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2392 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2476 KB Output is correct
38 Correct 34 ms 3796 KB Output is correct
39 Correct 36 ms 3952 KB Output is correct
40 Correct 30 ms 3948 KB Output is correct
41 Correct 35 ms 3908 KB Output is correct
42 Correct 34 ms 2652 KB Output is correct
43 Correct 35 ms 2648 KB Output is correct
44 Correct 35 ms 3288 KB Output is correct
45 Correct 35 ms 3904 KB Output is correct
46 Correct 33 ms 3796 KB Output is correct
47 Correct 36 ms 3916 KB Output is correct
48 Correct 33 ms 3796 KB Output is correct
49 Correct 29 ms 3800 KB Output is correct
50 Correct 30 ms 3820 KB Output is correct
51 Correct 35 ms 2648 KB Output is correct
52 Correct 34 ms 2652 KB Output is correct
53 Correct 35 ms 2652 KB Output is correct
54 Correct 33 ms 3912 KB Output is correct
55 Correct 35 ms 3796 KB Output is correct
56 Correct 21 ms 2396 KB Output is correct
57 Correct 14 ms 2652 KB Output is correct
58 Correct 21 ms 2396 KB Output is correct
59 Correct 22 ms 2652 KB Output is correct
60 Correct 15 ms 2652 KB Output is correct
61 Correct 24 ms 3028 KB Output is correct
62 Correct 35 ms 3284 KB Output is correct
63 Correct 42 ms 3540 KB Output is correct
64 Correct 35 ms 3428 KB Output is correct
65 Correct 35 ms 3288 KB Output is correct
66 Correct 35 ms 3288 KB Output is correct
67 Correct 35 ms 3296 KB Output is correct
68 Correct 35 ms 3452 KB Output is correct
69 Correct 39 ms 3440 KB Output is correct
70 Correct 36 ms 3284 KB Output is correct
71 Correct 41 ms 3284 KB Output is correct
72 Correct 36 ms 3296 KB Output is correct
73 Correct 35 ms 3316 KB Output is correct