Submission #540779

# Submission time Handle Problem Language Result Execution time Memory
540779 2022-03-21T17:25:37 Z status_coding Exhibition (JOI19_ho_t2) C++14
100 / 100
152 ms 4444 KB
#include <bits/stdc++.h>

using namespace std;

struct pos
{
    int val, s;

    bool operator<(pos b)
    {
        if(val != b.val)
            return val<b.val;
        return s < b.s;
    }
};

int n,m;
pos v[100005];
int s[100005];

int st, dr, mij, last;

bool ok(int k)
{
    int j=m-k+1;
    for(int i=1;i<=n;i++)
    {
        if(j<=m && v[i].s <= s[j])
            j++;
    }

    return (j == m+1);
}

int main()
{
    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>v[i].s>>v[i].val;
    sort(v+1, v+n+1);

    for(int i=1;i<=m;i++)
        cin>>s[i];
    sort(s+1, s+m+1);


    st=1, dr=n;
    while(st <= dr)
    {
        mij = (st+dr)/2;

        if(ok(mij))
        {
            last=mij;
            st=mij+1;
        }
        else
            dr=mij-1;
    }

    cout<<last;
    return 0;
}
# 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 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 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 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 2 ms 212 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 2 ms 312 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Correct 2 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 212 KB Output is correct
37 Correct 2 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 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 2 ms 212 KB Output is correct
21 Correct 2 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 2 ms 212 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 2 ms 312 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 212 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Correct 2 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 2 ms 212 KB Output is correct
37 Correct 2 ms 212 KB Output is correct
38 Correct 130 ms 1348 KB Output is correct
39 Correct 126 ms 4312 KB Output is correct
40 Correct 133 ms 4288 KB Output is correct
41 Correct 134 ms 4316 KB Output is correct
42 Correct 133 ms 4388 KB Output is correct
43 Correct 133 ms 4296 KB Output is correct
44 Correct 135 ms 4288 KB Output is correct
45 Correct 131 ms 4292 KB Output is correct
46 Correct 130 ms 4296 KB Output is correct
47 Correct 115 ms 3916 KB Output is correct
48 Correct 118 ms 3916 KB Output is correct
49 Correct 104 ms 3404 KB Output is correct
50 Correct 107 ms 3404 KB Output is correct
51 Correct 133 ms 4264 KB Output is correct
52 Correct 135 ms 4300 KB Output is correct
53 Correct 130 ms 4248 KB Output is correct
54 Correct 122 ms 4408 KB Output is correct
55 Correct 127 ms 4324 KB Output is correct
56 Correct 87 ms 3000 KB Output is correct
57 Correct 46 ms 1592 KB Output is correct
58 Correct 83 ms 2960 KB Output is correct
59 Correct 86 ms 2916 KB Output is correct
60 Correct 48 ms 1608 KB Output is correct
61 Correct 74 ms 2600 KB Output is correct
62 Correct 152 ms 4288 KB Output is correct
63 Correct 144 ms 4356 KB Output is correct
64 Correct 135 ms 4372 KB Output is correct
65 Correct 134 ms 4268 KB Output is correct
66 Correct 133 ms 4396 KB Output is correct
67 Correct 132 ms 4296 KB Output is correct
68 Correct 136 ms 4240 KB Output is correct
69 Correct 140 ms 4272 KB Output is correct
70 Correct 134 ms 4428 KB Output is correct
71 Correct 133 ms 4316 KB Output is correct
72 Correct 129 ms 4444 KB Output is correct
73 Correct 131 ms 4272 KB Output is correct