답안 #583163

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
583163 2022-06-24T23:13:54 Z stevancv Exhibition (JOI19_ho_t2) C++14
100 / 100
68 ms 5200 KB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define sp ' '
#define en '\n'
#define smin(a, b) a = min(a, b)
#define smax(a, b) a = max(a, b)
using namespace std;
const int N = 1e5 + 2;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    sort(a.rbegin(), a.rend());
    vector<int> b(m);
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    sort(b.rbegin(), b.rend());
    vector<int> bound(n);
    int j = 0;
    for (int i = 0; i < n; i++) {
        while (j < m && a[i].first <= b[j]) j++;
        bound[i] = j;
        swap(a[i].first, a[i].second);
    }
    vector<int> ord(n);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&] (int i, int j) {
            if (a[i].first != a[j].first) return a[i].first > a[j].first;
            return a[i].second > a[j].second;
    });
    int ans = 0;
    for (int i : ord) {
        if (bound[i] >= ans + 1) ans++;
    }
    cout << ans << en;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 328 KB Output is correct
25 Correct 2 ms 332 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 1 ms 328 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 320 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 328 KB Output is correct
25 Correct 2 ms 332 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 1 ms 328 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 360 KB Output is correct
38 Correct 50 ms 5060 KB Output is correct
39 Correct 52 ms 5160 KB Output is correct
40 Correct 44 ms 5196 KB Output is correct
41 Correct 51 ms 5056 KB Output is correct
42 Correct 62 ms 5160 KB Output is correct
43 Correct 52 ms 5176 KB Output is correct
44 Correct 51 ms 5160 KB Output is correct
45 Correct 59 ms 5088 KB Output is correct
46 Correct 54 ms 5056 KB Output is correct
47 Correct 53 ms 4764 KB Output is correct
48 Correct 57 ms 4684 KB Output is correct
49 Correct 48 ms 4084 KB Output is correct
50 Correct 46 ms 4060 KB Output is correct
51 Correct 54 ms 5192 KB Output is correct
52 Correct 58 ms 5172 KB Output is correct
53 Correct 56 ms 5080 KB Output is correct
54 Correct 43 ms 5200 KB Output is correct
55 Correct 60 ms 5192 KB Output is correct
56 Correct 50 ms 3820 KB Output is correct
57 Correct 21 ms 1604 KB Output is correct
58 Correct 33 ms 3804 KB Output is correct
59 Correct 39 ms 3912 KB Output is correct
60 Correct 19 ms 1620 KB Output is correct
61 Correct 43 ms 2900 KB Output is correct
62 Correct 56 ms 5184 KB Output is correct
63 Correct 55 ms 5184 KB Output is correct
64 Correct 60 ms 5068 KB Output is correct
65 Correct 58 ms 5180 KB Output is correct
66 Correct 68 ms 5184 KB Output is correct
67 Correct 65 ms 5052 KB Output is correct
68 Correct 57 ms 5164 KB Output is correct
69 Correct 63 ms 5068 KB Output is correct
70 Correct 61 ms 5060 KB Output is correct
71 Correct 63 ms 5184 KB Output is correct
72 Correct 62 ms 5168 KB Output is correct
73 Correct 51 ms 5060 KB Output is correct