답안 #916556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
916556 2024-01-26T05:50:33 Z viwlesxq Exhibition (JOI19_ho_t2) C++17
100 / 100
62 ms 8024 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define size(x) (int)x.size()

template<class S, class T>
bool chmin(S &a, const T &b) {
    return a > b && (a = b) == b;
}
template<class S, class T>
bool chmax(S &a, const T &b) {
    return a < b && (a = b) == b;
}
const int inf = 1e9 + 7;
const int INF = 1e18 + 7;
const int mod = 1e9 + 7;

void pair_sort(vector<int> &a, vector<int> &b, int n) {
    vector<pair<int, int>> v;
    for (int i = 0; i < n; ++i) v.push_back({a[i], b[i]});
    sort(all(v));
    for (int i = 0; i < n; ++i) a[i] = v[i].first, b[i] = v[i].second;
}

signed main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int n, m; cin >> n >> m;
    vector<int> s(n), v(n), c(m);
    for (int i = 0; i < n; ++i) cin >> s[i] >> v[i];
    for (int i = 0; i < m; ++i) cin >> c[i];
    sort(all(c));
    pair_sort(v, s, n);
    int lo = 0, hi = min(n, m) + 1;
    while (lo + 1 < hi) {
        int mid = (lo + hi) / 2;
        deque<int> arr;
        for (int i = m - mid; i < m; ++i) arr.push_back(c[i]);
        for (int i = 0; i < n; ++i) {
            if (!arr.empty() && s[i] <= arr.front()) {
                arr.pop_front();
            }
        }
        if (arr.empty()) lo = mid;
        else hi = mid;
    }
    cout << lo;
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 1 ms 452 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 456 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 452 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 1 ms 452 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 456 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 452 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 464 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 468 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 1 ms 452 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 460 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 456 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 452 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 464 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 468 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 43 ms 7892 KB Output is correct
39 Correct 42 ms 7632 KB Output is correct
40 Correct 42 ms 7776 KB Output is correct
41 Correct 44 ms 7884 KB Output is correct
42 Correct 45 ms 7868 KB Output is correct
43 Correct 41 ms 7868 KB Output is correct
44 Correct 41 ms 7888 KB Output is correct
45 Correct 43 ms 7788 KB Output is correct
46 Correct 42 ms 7628 KB Output is correct
47 Correct 41 ms 7348 KB Output is correct
48 Correct 42 ms 7408 KB Output is correct
49 Correct 35 ms 6604 KB Output is correct
50 Correct 34 ms 6672 KB Output is correct
51 Correct 42 ms 7888 KB Output is correct
52 Correct 40 ms 7884 KB Output is correct
53 Correct 44 ms 7768 KB Output is correct
54 Correct 40 ms 7892 KB Output is correct
55 Correct 42 ms 7888 KB Output is correct
56 Correct 25 ms 5980 KB Output is correct
57 Correct 16 ms 2136 KB Output is correct
58 Correct 26 ms 6104 KB Output is correct
59 Correct 28 ms 6112 KB Output is correct
60 Correct 14 ms 2140 KB Output is correct
61 Correct 25 ms 4560 KB Output is correct
62 Correct 52 ms 7664 KB Output is correct
63 Correct 56 ms 8024 KB Output is correct
64 Correct 50 ms 7792 KB Output is correct
65 Correct 48 ms 7644 KB Output is correct
66 Correct 47 ms 7892 KB Output is correct
67 Correct 62 ms 7888 KB Output is correct
68 Correct 60 ms 7768 KB Output is correct
69 Correct 49 ms 7884 KB Output is correct
70 Correct 45 ms 7784 KB Output is correct
71 Correct 58 ms 7668 KB Output is correct
72 Correct 44 ms 7888 KB Output is correct
73 Correct 58 ms 7884 KB Output is correct