Submission #485147

# Submission time Handle Problem Language Result Execution time Memory
485147 2021-11-06T10:43:25 Z ak2006 Exhibition (JOI19_ho_t2) C++14
100 / 100
61 ms 9104 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
const ll mod = 1e9 + 7,inf = 1e18;
#define pb push_back
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
void setIO()
{
    fast;
}
// bool cmp1(vi&f,vi&s)
// {
//     return (f[1] > s[1]) || (f[1] == s[1] and f[0] > s[0]);
// }
// bool cmp2(int f,int s)
// {
//     return f >= s;
// }
int main()
{
    setIO();
    int n,m;
    cin>>n>>m;
    vvi a(n,vi(2));
    for (int i = 0;i<n;i++)
        cin>>a[i][1]>>a[i][0];

    vi s(m);
    for (int i = 0;i<m;i++)cin>>s[i];
    
    //s[i + 1] >= s[i] and a[i + 1][1] >= a[i][1] and 
    //a[i][0] <= s[i]
    
    sort(a.begin(),a.end(),greater<>());
    sort(s.begin(),s.end(),greater<>());
    
    //hence s[i + 1] >= s[i] and a[pos + 1][1] >= a[pos][1]
    //hence we only need to ensure a[pos][0] <= s[i]
    
    int pos = 0;
    int ans = 0;
    for (int sz:s){
        while (pos < n and !(a[pos][1] <= sz))pos++;
        ans += pos++ < n;
    }
    cout<<ans<<"\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 52 ms 9036 KB Output is correct
39 Correct 52 ms 8980 KB Output is correct
40 Correct 47 ms 9028 KB Output is correct
41 Correct 53 ms 8980 KB Output is correct
42 Correct 61 ms 8984 KB Output is correct
43 Correct 52 ms 9028 KB Output is correct
44 Correct 53 ms 9028 KB Output is correct
45 Correct 52 ms 9028 KB Output is correct
46 Correct 52 ms 8980 KB Output is correct
47 Correct 51 ms 8644 KB Output is correct
48 Correct 47 ms 8652 KB Output is correct
49 Correct 40 ms 6832 KB Output is correct
50 Correct 45 ms 6840 KB Output is correct
51 Correct 52 ms 9084 KB Output is correct
52 Correct 54 ms 8976 KB Output is correct
53 Correct 51 ms 9036 KB Output is correct
54 Correct 47 ms 8980 KB Output is correct
55 Correct 53 ms 9028 KB Output is correct
56 Correct 39 ms 7708 KB Output is correct
57 Correct 17 ms 1604 KB Output is correct
58 Correct 37 ms 7708 KB Output is correct
59 Correct 37 ms 7696 KB Output is correct
60 Correct 16 ms 1612 KB Output is correct
61 Correct 34 ms 4172 KB Output is correct
62 Correct 52 ms 8972 KB Output is correct
63 Correct 51 ms 8988 KB Output is correct
64 Correct 54 ms 9032 KB Output is correct
65 Correct 51 ms 8972 KB Output is correct
66 Correct 53 ms 8980 KB Output is correct
67 Correct 52 ms 9072 KB Output is correct
68 Correct 51 ms 8992 KB Output is correct
69 Correct 52 ms 9028 KB Output is correct
70 Correct 54 ms 9104 KB Output is correct
71 Correct 52 ms 8980 KB Output is correct
72 Correct 54 ms 8976 KB Output is correct
73 Correct 51 ms 9088 KB Output is correct