답안 #957902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
957902 2024-04-04T13:08:47 Z aykhn Exhibition (JOI19_ho_t2) C++17
100 / 100
45 ms 5808 KB
#include <bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define inf 0x3F3F3F3F
 
vector<int> st;
 
void make(int l, int r, int x, int ind, int val)
{
    if (l + 1 == r)
    {
        st[x] = max(st[x], val);
        return;
    }
    int mid = (l + r) >> 1;
    if (ind < mid) make(l, mid, 2*x + 1, ind, val);
    else make(mid, r, 2*x + 2, ind, val);
    st[x] = max(st[2*x + 1], st[2*x + 2]);
}
int get(int l, int r, int x, int lx, int rx)
{
    if (l >= rx || r <= lx) return 0;
    if (l >= lx && r <= rx) return st[x];
    int mid = (l + r) >> 1;
    return max(get(l, mid, 2*x + 1, lx, rx), get(mid, r, 2*x + 2, lx, rx));
}
 
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, m, sz = 1;
    cin >> n >> m;
    int b[m];
    array<int, 2> a[n];
    for (array<int, 2> &x : a) cin >> x[1] >> x[0];
    for (int &i : b) cin >> i;
    sort(a, a + n, greater<array<int, 2>> ()), sort(b, b + m);
    int res = 0;
    for (array<int, 2> &x : a)
    {
        if (x[1] <= b[m - res - 1]) 
        {
            res++;
            if (res == m) break;
        }
    }
    cout << res << '\n';
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:34:15: warning: unused variable 'sz' [-Wunused-variable]
   34 |     int n, m, sz = 1;
      |               ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 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 1 ms 452 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 448 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 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 1 ms 452 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 448 KB Output is correct
18 Correct 1 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 348 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 344 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 508 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 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 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 1 ms 452 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 448 KB Output is correct
18 Correct 1 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 348 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 344 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 508 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 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 44 ms 5808 KB Output is correct
39 Correct 38 ms 5460 KB Output is correct
40 Correct 33 ms 5588 KB Output is correct
41 Correct 40 ms 5588 KB Output is correct
42 Correct 38 ms 5684 KB Output is correct
43 Correct 45 ms 5468 KB Output is correct
44 Correct 44 ms 5464 KB Output is correct
45 Correct 38 ms 5596 KB Output is correct
46 Correct 37 ms 5468 KB Output is correct
47 Correct 34 ms 4956 KB Output is correct
48 Correct 34 ms 4944 KB Output is correct
49 Correct 30 ms 4624 KB Output is correct
50 Correct 32 ms 4828 KB Output is correct
51 Correct 38 ms 5452 KB Output is correct
52 Correct 40 ms 5464 KB Output is correct
53 Correct 38 ms 5460 KB Output is correct
54 Correct 32 ms 5704 KB Output is correct
55 Correct 39 ms 5468 KB Output is correct
56 Correct 24 ms 3924 KB Output is correct
57 Correct 17 ms 2200 KB Output is correct
58 Correct 26 ms 3944 KB Output is correct
59 Correct 24 ms 3932 KB Output is correct
60 Correct 14 ms 2136 KB Output is correct
61 Correct 23 ms 3420 KB Output is correct
62 Correct 38 ms 5468 KB Output is correct
63 Correct 38 ms 5468 KB Output is correct
64 Correct 38 ms 5468 KB Output is correct
65 Correct 37 ms 5468 KB Output is correct
66 Correct 39 ms 5728 KB Output is correct
67 Correct 38 ms 5468 KB Output is correct
68 Correct 41 ms 5464 KB Output is correct
69 Correct 38 ms 5468 KB Output is correct
70 Correct 41 ms 5724 KB Output is correct
71 Correct 37 ms 5468 KB Output is correct
72 Correct 41 ms 5460 KB Output is correct
73 Correct 37 ms 5464 KB Output is correct