답안 #787615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
787615 2023-07-19T10:27:11 Z andecaandeci Exhibition (JOI19_ho_t2) C++17
100 / 100
51 ms 5608 KB
#include<bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long, long long>
// jangan kebiasa kalah
// kalo OI, sampah aja dulu, tapi jangan menutup kemungkinan buat AC

long long n,m,b[100069],ans;
pll arr[100069];

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    long long i,j;
    cin>>n>>m;
    for(i=1;i<=n;i++)
    {
        cin>>arr[i].se>>arr[i].fi;
    }
    j = m;
    bool pernah = 0;
    for(i=1;i<=m;i++)
    {
        cin>>b[i];
    }
    sort(arr+1,arr+n+1);
    sort(b+1,b+m+1);
    // i < j -> b[i] <= b[j] and arr[i].fi <= arr[j].fi
    // fi = val, se = size
    for(i=n;i and j;i--)
    {
        if(arr[i].se <= b[j])
        {
            --j;
            ++ans;
        }
    }
    cout<<ans<<'\n';
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:25:10: warning: unused variable 'pernah' [-Wunused-variable]
   25 |     bool pernah = 0;
      |          ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 260 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 260 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 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 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 260 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 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 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 36 ms 5464 KB Output is correct
39 Correct 37 ms 5476 KB Output is correct
40 Correct 32 ms 5500 KB Output is correct
41 Correct 38 ms 5540 KB Output is correct
42 Correct 42 ms 5564 KB Output is correct
43 Correct 46 ms 5532 KB Output is correct
44 Correct 39 ms 5556 KB Output is correct
45 Correct 46 ms 5436 KB Output is correct
46 Correct 51 ms 5520 KB Output is correct
47 Correct 33 ms 4940 KB Output is correct
48 Correct 33 ms 5008 KB Output is correct
49 Correct 33 ms 4592 KB Output is correct
50 Correct 30 ms 4484 KB Output is correct
51 Correct 40 ms 5512 KB Output is correct
52 Correct 39 ms 5544 KB Output is correct
53 Correct 39 ms 5436 KB Output is correct
54 Correct 31 ms 5516 KB Output is correct
55 Correct 37 ms 5524 KB Output is correct
56 Correct 23 ms 3796 KB Output is correct
57 Correct 14 ms 2084 KB Output is correct
58 Correct 24 ms 3788 KB Output is correct
59 Correct 23 ms 3756 KB Output is correct
60 Correct 14 ms 2092 KB Output is correct
61 Correct 22 ms 3292 KB Output is correct
62 Correct 37 ms 5556 KB Output is correct
63 Correct 37 ms 5540 KB Output is correct
64 Correct 37 ms 5548 KB Output is correct
65 Correct 36 ms 5464 KB Output is correct
66 Correct 37 ms 5460 KB Output is correct
67 Correct 45 ms 5552 KB Output is correct
68 Correct 36 ms 5608 KB Output is correct
69 Correct 39 ms 5520 KB Output is correct
70 Correct 38 ms 5444 KB Output is correct
71 Correct 36 ms 5532 KB Output is correct
72 Correct 37 ms 5452 KB Output is correct
73 Correct 34 ms 5448 KB Output is correct