Submission #724592

# Submission time Handle Problem Language Result Execution time Memory
724592 2023-04-15T15:30:48 Z joelgun14 Exhibition (JOI19_ho_t2) C++17
100 / 100
516 ms 9084 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, m;
    cin >> n >> m;
    pair<int, int> a[n + 1];
    for(int i = 1; i <= n; ++i)
        cin >> a[i].first >> a[i].second;
    sort(a + 1, a + n + 1);
    int b[m + 1];
    for(int i = 1; i <= m; ++i)
        cin >> b[i];
    sort(b + 1, b + m + 1);
    // coba minimum value yg bs masuk ke frame
    int l = 0, r = m, res = 0;
    while(l <= r) {
        int mid = (l + r) / 2;
        int idx = 1;
        multiset<int> s;
        int pr = 0;
        bool ans = 1;
        //cout << "MID " << mid << endl;
        for(int i = m - mid + 1; i <= m; ++i) {
            while(idx <= n && a[idx].first <= b[i]) {
                s.insert(a[idx].second);
                //cout << "DEBUG " << i << " " << a[idx].second << endl;
                ++idx;
            }
            // ambil 1
            //cout << pr << endl;
            if(s.lower_bound(pr) == s.end()) {
                ans = 0;
                break;
            }
            else {
                pr = *s.lower_bound(pr);
                s.erase(s.lower_bound(pr));
            }
        }
        if(ans)
            l = mid + 1, res = mid;
        else
            r = mid - 1;
    }
    cout << res << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 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 340 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 316 KB Output is correct
16 Correct 1 ms 284 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 0 ms 320 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 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 340 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 316 KB Output is correct
16 Correct 1 ms 284 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 0 ms 320 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 356 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 2 ms 352 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 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 340 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 316 KB Output is correct
16 Correct 1 ms 284 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 0 ms 320 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 356 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 356 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 2 ms 332 KB Output is correct
30 Correct 2 ms 340 KB Output is correct
31 Correct 2 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 2 ms 352 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 340 KB Output is correct
37 Correct 2 ms 340 KB Output is correct
38 Correct 238 ms 6712 KB Output is correct
39 Correct 241 ms 6712 KB Output is correct
40 Correct 297 ms 7100 KB Output is correct
41 Correct 236 ms 6836 KB Output is correct
42 Correct 45 ms 4268 KB Output is correct
43 Correct 45 ms 4260 KB Output is correct
44 Correct 330 ms 6720 KB Output is correct
45 Correct 516 ms 8316 KB Output is correct
46 Correct 490 ms 8248 KB Output is correct
47 Correct 492 ms 7352 KB Output is correct
48 Correct 499 ms 7528 KB Output is correct
49 Correct 339 ms 6220 KB Output is correct
50 Correct 342 ms 6328 KB Output is correct
51 Correct 43 ms 4292 KB Output is correct
52 Correct 45 ms 4264 KB Output is correct
53 Correct 44 ms 4268 KB Output is correct
54 Correct 400 ms 9084 KB Output is correct
55 Correct 265 ms 6820 KB Output is correct
56 Correct 37 ms 5296 KB Output is correct
57 Correct 19 ms 1620 KB Output is correct
58 Correct 113 ms 7604 KB Output is correct
59 Correct 269 ms 7756 KB Output is correct
60 Correct 17 ms 1620 KB Output is correct
61 Correct 163 ms 3776 KB Output is correct
62 Correct 451 ms 6724 KB Output is correct
63 Correct 476 ms 6832 KB Output is correct
64 Correct 488 ms 6720 KB Output is correct
65 Correct 489 ms 6836 KB Output is correct
66 Correct 483 ms 6732 KB Output is correct
67 Correct 481 ms 6740 KB Output is correct
68 Correct 449 ms 6724 KB Output is correct
69 Correct 475 ms 6728 KB Output is correct
70 Correct 463 ms 6860 KB Output is correct
71 Correct 492 ms 6828 KB Output is correct
72 Correct 504 ms 6832 KB Output is correct
73 Correct 383 ms 6808 KB Output is correct