Submission #641922

# Submission time Handle Problem Language Result Execution time Memory
641922 2022-09-17T22:18:10 Z danikoynov Exhibition (JOI19_ho_t2) C++14
100 / 100
552 ms 4864 KB
/**
 ____ ____ ____ ____ ____ ____
||l |||e |||i |||n |||a |||d ||
||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/__\|

**/

#include<bits/stdc++.h>
#define endl '\n'

using namespace std;
typedef long long ll;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

const int maxn = 1e5 + 10;

struct picture
{
    int s, v;
}p[maxn];

bool cmp(picture p1, picture p2)
{
    if (p1.v < p2.v)
    return true;
    if (p1.v > p2.v)
        return false;
    return p1.s < p2.s;
}

int n, m, c[maxn], used[maxn], dp[maxn];

void solve()
{
    cin >> n >> m;
    for (int i = 1; i <= n; i ++)
    {
        cin >> p[i].s >> p[i].v;
    }

    for (int i = 1; i <= m; i ++)
        cin >> c[i];



    sort(c + 1, c + m + 1);
    sort(p + 1, p + n + 1, cmp);
    ///cout << check(2) << endl;
    ///return;

    int ans = 0;
        for (int i = n; i > 0; i --)
        {
            int mx = ans;

            mx ++;
            mx = min(mx, m);
            while(mx > 0 && c[m - mx + 1] < p[i].s)
                mx --;
            dp[i] = mx;
            ans = max(ans, dp[i]);

        }

    cout << ans << endl;


}

int main()
{
    solve();
    return 0;
}

/**
10 10
978749728 144544247
765886828 382970504
724321206 775440108
793469869 329793955
744661733 757784475
737531928 772848949
880702330 298220471
886356598 234769581
756489712 541017091
976784156 205683907
498207927
462526472
688444509
591128229
744661733
421432475
299894333
737531928
39584784
724321206

*/
# Verdict Execution time Memory 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 308 KB Output is correct
18 Correct 0 ms 308 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 308 KB Output is correct
18 Correct 0 ms 308 KB Output is correct
19 Correct 0 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 2 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 2 ms 324 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 320 KB Output is correct
30 Correct 2 ms 324 KB Output is correct
31 Correct 2 ms 320 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 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 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 308 KB Output is correct
18 Correct 0 ms 308 KB Output is correct
19 Correct 0 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 2 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 340 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 2 ms 324 KB Output is correct
28 Correct 2 ms 340 KB Output is correct
29 Correct 2 ms 320 KB Output is correct
30 Correct 2 ms 324 KB Output is correct
31 Correct 2 ms 320 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 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 122 ms 4728 KB Output is correct
39 Correct 121 ms 4684 KB Output is correct
40 Correct 119 ms 4740 KB Output is correct
41 Correct 122 ms 4736 KB Output is correct
42 Correct 122 ms 4684 KB Output is correct
43 Correct 122 ms 4688 KB Output is correct
44 Correct 552 ms 4796 KB Output is correct
45 Correct 123 ms 4736 KB Output is correct
46 Correct 123 ms 4700 KB Output is correct
47 Correct 260 ms 4280 KB Output is correct
48 Correct 261 ms 4336 KB Output is correct
49 Correct 101 ms 3784 KB Output is correct
50 Correct 96 ms 3680 KB Output is correct
51 Correct 124 ms 4748 KB Output is correct
52 Correct 125 ms 4760 KB Output is correct
53 Correct 125 ms 4660 KB Output is correct
54 Correct 119 ms 4692 KB Output is correct
55 Correct 120 ms 4664 KB Output is correct
56 Correct 82 ms 3276 KB Output is correct
57 Correct 42 ms 1564 KB Output is correct
58 Correct 84 ms 3396 KB Output is correct
59 Correct 100 ms 3316 KB Output is correct
60 Correct 42 ms 1652 KB Output is correct
61 Correct 87 ms 2672 KB Output is correct
62 Correct 397 ms 4672 KB Output is correct
63 Correct 396 ms 4712 KB Output is correct
64 Correct 406 ms 4804 KB Output is correct
65 Correct 394 ms 4684 KB Output is correct
66 Correct 394 ms 4720 KB Output is correct
67 Correct 395 ms 4752 KB Output is correct
68 Correct 436 ms 4852 KB Output is correct
69 Correct 393 ms 4684 KB Output is correct
70 Correct 395 ms 4696 KB Output is correct
71 Correct 390 ms 4748 KB Output is correct
72 Correct 390 ms 4864 KB Output is correct
73 Correct 380 ms 4684 KB Output is correct