답안 #574070

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574070 2022-06-07T16:51:23 Z Ronin13 Exhibition (JOI19_ho_t2) C++14
100 / 100
584 ms 10964 KB
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb push_back
#define epb emplace_back
using namespace std;

const ll linf = 1e18 + 1;

int main(){
    int n; cin >> n;
    int m; cin >> m;
    vector <ll> d(n + 1, linf);
    d[0] = 0;
    pll a[n + 1];
    ll b[m + 1];
    for(int i = 1; i <= n; i++){
        cin >> a[i].f >> a[i].s;
    }
    for(int i= 1; i <= m; i++) cin >> b[i];
    int l = 0, r = n + 1;
    sort(a  + 1 , a + 1 + n);
    sort(b + 1, b +  1 + m);
    while(l + 1 < r){
        int mid = (l + r) / 2;
        multiset <ll> st;
        ll last = -1;
        bool ind = true;
        int cur = 1;
        if(m < mid) {
            r = mid;
            continue;
        }
        for(int i = m - mid + 1; i <= m; i++){
            while(cur <= n && a[cur].f <= b[i])
                st.insert(a[cur].s), cur++;
            if(st.empty()) {
                ind = false;
                break;
            }
            multiset <ll> :: iterator it = st.lower_bound(last);
            if(it == st.end()){
                ind = false;
                break;
            }
            last = *it;
            st.erase(it);
        }
        if(ind) l = mid;
        else r = mid;
    }
    cout << l;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 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 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 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 296 KB Output is correct
20 Correct 2 ms 356 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 308 KB Output is correct
24 Correct 3 ms 340 KB Output is correct
25 Correct 3 ms 340 KB Output is correct
26 Correct 3 ms 312 KB Output is correct
27 Correct 2 ms 292 KB Output is correct
28 Correct 2 ms 308 KB Output is correct
29 Correct 4 ms 340 KB Output is correct
30 Correct 3 ms 340 KB Output is correct
31 Correct 3 ms 340 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 3 ms 380 KB Output is correct
37 Correct 3 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 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 296 KB Output is correct
20 Correct 2 ms 356 KB Output is correct
21 Correct 3 ms 340 KB Output is correct
22 Correct 2 ms 340 KB Output is correct
23 Correct 2 ms 308 KB Output is correct
24 Correct 3 ms 340 KB Output is correct
25 Correct 3 ms 340 KB Output is correct
26 Correct 3 ms 312 KB Output is correct
27 Correct 2 ms 292 KB Output is correct
28 Correct 2 ms 308 KB Output is correct
29 Correct 4 ms 340 KB Output is correct
30 Correct 3 ms 340 KB Output is correct
31 Correct 3 ms 340 KB Output is correct
32 Correct 1 ms 308 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 3 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 3 ms 380 KB Output is correct
37 Correct 3 ms 312 KB Output is correct
38 Correct 288 ms 8612 KB Output is correct
39 Correct 307 ms 8612 KB Output is correct
40 Correct 344 ms 9032 KB Output is correct
41 Correct 297 ms 8660 KB Output is correct
42 Correct 123 ms 6232 KB Output is correct
43 Correct 122 ms 6324 KB Output is correct
44 Correct 379 ms 8652 KB Output is correct
45 Correct 537 ms 10188 KB Output is correct
46 Correct 566 ms 10188 KB Output is correct
47 Correct 318 ms 8560 KB Output is correct
48 Correct 310 ms 8544 KB Output is correct
49 Correct 380 ms 8068 KB Output is correct
50 Correct 387 ms 7956 KB Output is correct
51 Correct 131 ms 6324 KB Output is correct
52 Correct 121 ms 6220 KB Output is correct
53 Correct 122 ms 6272 KB Output is correct
54 Correct 440 ms 10964 KB Output is correct
55 Correct 304 ms 8652 KB Output is correct
56 Correct 99 ms 6840 KB Output is correct
57 Correct 55 ms 1940 KB Output is correct
58 Correct 114 ms 9156 KB Output is correct
59 Correct 180 ms 9160 KB Output is correct
60 Correct 51 ms 2032 KB Output is correct
61 Correct 209 ms 4824 KB Output is correct
62 Correct 518 ms 8652 KB Output is correct
63 Correct 511 ms 8780 KB Output is correct
64 Correct 535 ms 8648 KB Output is correct
65 Correct 530 ms 8648 KB Output is correct
66 Correct 519 ms 8780 KB Output is correct
67 Correct 527 ms 8648 KB Output is correct
68 Correct 481 ms 8664 KB Output is correct
69 Correct 551 ms 8776 KB Output is correct
70 Correct 584 ms 8664 KB Output is correct
71 Correct 522 ms 8592 KB Output is correct
72 Correct 542 ms 8660 KB Output is correct
73 Correct 418 ms 8648 KB Output is correct