답안 #1091211

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1091211 2024-09-20T07:12:27 Z TrinhKhanhDung Exhibition (JOI19_ho_t2) C++14
100 / 100
44 ms 4540 KB
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define sz(x) (int)x.size()
#define ALL(v) v.begin(),v.end()
#define MASK(k) (1LL << (k))
#define BIT(x, i) (((x) >> (i)) & 1)
#define oo (ll)1e18
#define INF (ll)1e9
#define MOD (ll)(1e9 + 7)
#define double long double

using namespace std;

template<class T1, class T2>
    bool maximize(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}

template<class T1, class T2>
    bool minimize(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}

template<class T1, class T2>
    void add(T1 &a, T2 b){a += b; if(a >= MOD) a -= MOD;}

template<class T1, class T2>
    void sub(T1 &a, T2 b){a -= b; if(a < 0) a += MOD;}

template<class T>
    void cps(T &v){sort(ALL(v)); v.resize(unique(ALL(v)) - v.begin());}

const int MAX = 1e5 + 10;

int N, M;
pair<int, int> picture[MAX];
int frame[MAX];

void solve(){
    cin >> N >> M;
    for(int i = 1; i <= N; i++){
        cin >> picture[i].se >> picture[i].fi;
    }
    for(int i = 1; i <= M; i++) cin >> frame[i];

    sort(picture + 1, picture + N + 1, greater<pair<int, int>>());
    sort(frame + 1, frame + M + 1, greater<int>());

    int ans = 0;
    for(int i = 1, j = 1; i <= M; i++){
        while(j <= N && picture[j].se > frame[i]) j++;
        if(j > N) break;
        j++;
        ans++;
    }

    cout << ans << '\n';
}

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
//     freopen("mst.inp","r",stdin);
//     freopen("mst.out","w",stdout);

    int t = 1;
//    cin >> t;
    while(t--){
        solve();
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 380 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 352 KB Output is correct
18 Correct 0 ms 352 KB Output is correct
19 Correct 0 ms 356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 380 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 352 KB Output is correct
18 Correct 0 ms 352 KB Output is correct
19 Correct 0 ms 356 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 472 KB Output is correct
23 Correct 1 ms 356 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 472 KB Output is correct
26 Correct 1 ms 348 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 356 KB Output is correct
30 Correct 1 ms 356 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 352 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 352 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 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 380 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 352 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 464 KB Output is correct
17 Correct 0 ms 352 KB Output is correct
18 Correct 0 ms 352 KB Output is correct
19 Correct 0 ms 356 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 472 KB Output is correct
23 Correct 1 ms 356 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 472 KB Output is correct
26 Correct 1 ms 348 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 356 KB Output is correct
30 Correct 1 ms 356 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 352 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 352 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 34 ms 4448 KB Output is correct
39 Correct 31 ms 4440 KB Output is correct
40 Correct 30 ms 4312 KB Output is correct
41 Correct 44 ms 4476 KB Output is correct
42 Correct 35 ms 4448 KB Output is correct
43 Correct 35 ms 4488 KB Output is correct
44 Correct 32 ms 4440 KB Output is correct
45 Correct 34 ms 4304 KB Output is correct
46 Correct 42 ms 4444 KB Output is correct
47 Correct 28 ms 3932 KB Output is correct
48 Correct 28 ms 3928 KB Output is correct
49 Correct 26 ms 3676 KB Output is correct
50 Correct 26 ms 3676 KB Output is correct
51 Correct 32 ms 4424 KB Output is correct
52 Correct 32 ms 4468 KB Output is correct
53 Correct 33 ms 4444 KB Output is correct
54 Correct 29 ms 4444 KB Output is correct
55 Correct 36 ms 4540 KB Output is correct
56 Correct 23 ms 3164 KB Output is correct
57 Correct 14 ms 1824 KB Output is correct
58 Correct 21 ms 2908 KB Output is correct
59 Correct 22 ms 3164 KB Output is correct
60 Correct 13 ms 1628 KB Output is correct
61 Correct 20 ms 2652 KB Output is correct
62 Correct 33 ms 4308 KB Output is correct
63 Correct 33 ms 4444 KB Output is correct
64 Correct 37 ms 4440 KB Output is correct
65 Correct 39 ms 4444 KB Output is correct
66 Correct 35 ms 4440 KB Output is correct
67 Correct 36 ms 4356 KB Output is correct
68 Correct 35 ms 4444 KB Output is correct
69 Correct 37 ms 4436 KB Output is correct
70 Correct 36 ms 4440 KB Output is correct
71 Correct 33 ms 4328 KB Output is correct
72 Correct 37 ms 4440 KB Output is correct
73 Correct 30 ms 4444 KB Output is correct