Submission #108745

# Submission time Handle Problem Language Result Execution time Memory
108745 2019-05-01T08:13:17 Z tictaccat Exhibition (JOI19_ho_t2) C++14
100 / 100
213 ms 4576 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX = 1e5 + 10;

int N,M;
vector<pair<int,int>> pics(MAX);
vector<int> C(MAX);

bool check(int k) {
    if (k > M) return false;
    int j = 0;
    for (int i = 0; i < k; i++) {
        while (j < N && pics[j].first > C[M-k+i]) j++;
        if (j == N) return false;
        j++;
    }
    return true;
}

int main() {

    cin >> N >> M;
    for (int i = 0; i < N; i++) cin >> pics[i].first >> pics[i].second;
    for (int i = 0; i < M; i++) cin >> C[i];

    sort(pics.begin(),pics.begin()+N,[](pair<int,int> p1, pair<int,int> p2) {return p1.second < p2.second || (p1.second == p2.second && p1.first < p2.first);});
    sort(C.begin(),C.begin()+M);

    int k = 0; int high = N+1;

    for (int b = high/2; b > 0; b /= 2) {
        while (k + b < high && check(k+b)) k += b;
    }

    cout << k << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1536 KB Output is correct
2 Correct 4 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Correct 3 ms 1536 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
14 Correct 3 ms 1536 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 3 ms 1536 KB Output is correct
17 Correct 4 ms 1536 KB Output is correct
18 Correct 3 ms 1536 KB Output is correct
19 Correct 3 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1536 KB Output is correct
2 Correct 4 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Correct 3 ms 1536 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
14 Correct 3 ms 1536 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 3 ms 1536 KB Output is correct
17 Correct 4 ms 1536 KB Output is correct
18 Correct 3 ms 1536 KB Output is correct
19 Correct 3 ms 1536 KB Output is correct
20 Correct 5 ms 1536 KB Output is correct
21 Correct 7 ms 1536 KB Output is correct
22 Correct 6 ms 1536 KB Output is correct
23 Correct 6 ms 1536 KB Output is correct
24 Correct 6 ms 1536 KB Output is correct
25 Correct 5 ms 1536 KB Output is correct
26 Correct 6 ms 1536 KB Output is correct
27 Correct 5 ms 1536 KB Output is correct
28 Correct 7 ms 1508 KB Output is correct
29 Correct 6 ms 1536 KB Output is correct
30 Correct 5 ms 1536 KB Output is correct
31 Correct 4 ms 1536 KB Output is correct
32 Correct 5 ms 1536 KB Output is correct
33 Correct 4 ms 1664 KB Output is correct
34 Correct 4 ms 1536 KB Output is correct
35 Correct 3 ms 1536 KB Output is correct
36 Correct 5 ms 1536 KB Output is correct
37 Correct 4 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1536 KB Output is correct
2 Correct 4 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Correct 3 ms 1536 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 4 ms 1536 KB Output is correct
7 Correct 4 ms 1536 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 4 ms 1536 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
14 Correct 3 ms 1536 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 3 ms 1536 KB Output is correct
17 Correct 4 ms 1536 KB Output is correct
18 Correct 3 ms 1536 KB Output is correct
19 Correct 3 ms 1536 KB Output is correct
20 Correct 5 ms 1536 KB Output is correct
21 Correct 7 ms 1536 KB Output is correct
22 Correct 6 ms 1536 KB Output is correct
23 Correct 6 ms 1536 KB Output is correct
24 Correct 6 ms 1536 KB Output is correct
25 Correct 5 ms 1536 KB Output is correct
26 Correct 6 ms 1536 KB Output is correct
27 Correct 5 ms 1536 KB Output is correct
28 Correct 7 ms 1508 KB Output is correct
29 Correct 6 ms 1536 KB Output is correct
30 Correct 5 ms 1536 KB Output is correct
31 Correct 4 ms 1536 KB Output is correct
32 Correct 5 ms 1536 KB Output is correct
33 Correct 4 ms 1664 KB Output is correct
34 Correct 4 ms 1536 KB Output is correct
35 Correct 3 ms 1536 KB Output is correct
36 Correct 5 ms 1536 KB Output is correct
37 Correct 4 ms 1536 KB Output is correct
38 Correct 178 ms 4348 KB Output is correct
39 Correct 148 ms 4348 KB Output is correct
40 Correct 146 ms 4472 KB Output is correct
41 Correct 143 ms 4472 KB Output is correct
42 Correct 139 ms 4472 KB Output is correct
43 Correct 170 ms 4380 KB Output is correct
44 Correct 156 ms 4472 KB Output is correct
45 Correct 159 ms 4472 KB Output is correct
46 Correct 160 ms 4316 KB Output is correct
47 Correct 152 ms 4084 KB Output is correct
48 Correct 143 ms 4060 KB Output is correct
49 Correct 118 ms 3832 KB Output is correct
50 Correct 112 ms 3752 KB Output is correct
51 Correct 148 ms 4472 KB Output is correct
52 Correct 163 ms 4344 KB Output is correct
53 Correct 158 ms 4344 KB Output is correct
54 Correct 204 ms 4344 KB Output is correct
55 Correct 144 ms 4344 KB Output is correct
56 Correct 96 ms 3576 KB Output is correct
57 Correct 58 ms 2424 KB Output is correct
58 Correct 98 ms 3448 KB Output is correct
59 Correct 104 ms 3448 KB Output is correct
60 Correct 56 ms 2424 KB Output is correct
61 Correct 87 ms 3064 KB Output is correct
62 Correct 172 ms 4348 KB Output is correct
63 Correct 185 ms 4472 KB Output is correct
64 Correct 184 ms 4472 KB Output is correct
65 Correct 169 ms 4428 KB Output is correct
66 Correct 213 ms 4352 KB Output is correct
67 Correct 190 ms 4344 KB Output is correct
68 Correct 168 ms 4380 KB Output is correct
69 Correct 177 ms 4376 KB Output is correct
70 Correct 188 ms 4476 KB Output is correct
71 Correct 173 ms 4444 KB Output is correct
72 Correct 161 ms 4384 KB Output is correct
73 Correct 198 ms 4576 KB Output is correct