답안 #252984

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
252984 2020-07-26T15:11:18 Z Atill83 Exhibition (JOI19_ho_t2) C++14
100 / 100
78 ms 4568 KB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define endl '\n'
using namespace std;
const long long INF = (long long) 1e18;
const int mod = (int) 1e9+7;
const int MAXN = (int) 3e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
ll n, m;
pii pic[MAXN];
int c[MAXN];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);

    #ifdef Local
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/int.txt","r",stdin);
        freopen("C:/Users/Admin/Desktop/Yazilim/C/IO/out.txt","w",stdout);
    #endif

    cin>>n>>m;

    for(int i = 0; i < n; i++){
        int v, s;
        cin>>s>>v;
        pic[i] = {v, s};
    }

    sort(pic, pic + n);

    for(int i = 0; i < m; i++){
        cin>>c[i];
    }

    sort(c, c + m);

    ll res = 0, cur = n - 1;

    for(int j = m - 1; j >= 0; j--){
        while(cur >= 0 && pic[cur].ss > c[j]) cur--;
        if(cur >= 0){
            cur--;
            res++;
        }
    }

    cout<<res<<endl;


    

    #ifdef Local
        cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds ";
    #endif
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 512 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 0 ms 384 KB Output is correct
16 Correct 0 ms 384 KB Output is correct
17 Correct 0 ms 384 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 512 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 59 ms 4472 KB Output is correct
39 Correct 60 ms 4568 KB Output is correct
40 Correct 58 ms 4472 KB Output is correct
41 Correct 63 ms 4520 KB Output is correct
42 Correct 59 ms 4480 KB Output is correct
43 Correct 62 ms 4472 KB Output is correct
44 Correct 61 ms 4476 KB Output is correct
45 Correct 69 ms 4344 KB Output is correct
46 Correct 56 ms 4344 KB Output is correct
47 Correct 52 ms 3960 KB Output is correct
48 Correct 53 ms 3960 KB Output is correct
49 Correct 46 ms 3576 KB Output is correct
50 Correct 46 ms 3580 KB Output is correct
51 Correct 58 ms 4472 KB Output is correct
52 Correct 58 ms 4472 KB Output is correct
53 Correct 58 ms 4344 KB Output is correct
54 Correct 56 ms 4472 KB Output is correct
55 Correct 61 ms 4368 KB Output is correct
56 Correct 35 ms 3072 KB Output is correct
57 Correct 23 ms 1792 KB Output is correct
58 Correct 39 ms 3064 KB Output is correct
59 Correct 37 ms 3064 KB Output is correct
60 Correct 23 ms 1664 KB Output is correct
61 Correct 35 ms 2688 KB Output is correct
62 Correct 60 ms 4472 KB Output is correct
63 Correct 78 ms 4472 KB Output is correct
64 Correct 59 ms 4472 KB Output is correct
65 Correct 57 ms 4472 KB Output is correct
66 Correct 60 ms 4364 KB Output is correct
67 Correct 63 ms 4472 KB Output is correct
68 Correct 61 ms 4472 KB Output is correct
69 Correct 62 ms 4472 KB Output is correct
70 Correct 59 ms 4472 KB Output is correct
71 Correct 57 ms 4472 KB Output is correct
72 Correct 62 ms 4472 KB Output is correct
73 Correct 57 ms 4476 KB Output is correct