답안 #153274

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153274 2019-09-13T07:13:52 Z mhy908 Exhibition (JOI19_ho_t2) C++14
100 / 100
81 ms 5700 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define llinf 8987654321987654321
#define inf 1987654321
using namespace std;
typedef long long LL;
typedef pair<LL, LL> pll;
int n, m;
LL frame[100010];
pll pic[100010];
bool poss(int num)
{
    for(int i=1, j=m-num+1; i<=n&&j<=m; i++){
        if(pic[i].S<=frame[j])j++;
        if(j>=m+1)return true;
    }
    return false;
}
int f(int st, int fin)
{
    if(st==fin)return st;
    int mid=(st+fin)/2+1;
    if(poss(mid))return f(mid, fin);
    return f(st, mid-1);
}
int main()
{
    scanf("%d %d", &n, &m);
    for(int i=1; i<=n; i++){
        scanf("%lld %lld", &pic[i].S, &pic[i].F);
    }
    sort(pic+1, pic+n+1);
    for(int i=1; i<=m; i++){
        scanf("%lld", &frame[i]);
    }
    sort(frame+1, frame+m+1);
    printf("%d", f(0, m));
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:30:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld %lld", &pic[i].S, &pic[i].F);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &frame[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 504 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 1 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 504 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 1 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 3 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 376 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 3 ms 380 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 504 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 1 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 376 KB Output is correct
26 Correct 3 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
29 Correct 3 ms 376 KB Output is correct
30 Correct 3 ms 376 KB Output is correct
31 Correct 3 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
33 Correct 2 ms 376 KB Output is correct
34 Correct 3 ms 376 KB Output is correct
35 Correct 2 ms 376 KB Output is correct
36 Correct 3 ms 380 KB Output is correct
37 Correct 3 ms 376 KB Output is correct
38 Correct 73 ms 5576 KB Output is correct
39 Correct 72 ms 5504 KB Output is correct
40 Correct 67 ms 5532 KB Output is correct
41 Correct 74 ms 5504 KB Output is correct
42 Correct 75 ms 5624 KB Output is correct
43 Correct 73 ms 5624 KB Output is correct
44 Correct 73 ms 5620 KB Output is correct
45 Correct 73 ms 5496 KB Output is correct
46 Correct 71 ms 5624 KB Output is correct
47 Correct 67 ms 5084 KB Output is correct
48 Correct 65 ms 4984 KB Output is correct
49 Correct 59 ms 4472 KB Output is correct
50 Correct 59 ms 4476 KB Output is correct
51 Correct 72 ms 5700 KB Output is correct
52 Correct 72 ms 5624 KB Output is correct
53 Correct 72 ms 5496 KB Output is correct
54 Correct 57 ms 5552 KB Output is correct
55 Correct 70 ms 5600 KB Output is correct
56 Correct 46 ms 3836 KB Output is correct
57 Correct 28 ms 2040 KB Output is correct
58 Correct 44 ms 3832 KB Output is correct
59 Correct 45 ms 3836 KB Output is correct
60 Correct 29 ms 2040 KB Output is correct
61 Correct 46 ms 3320 KB Output is correct
62 Correct 79 ms 5496 KB Output is correct
63 Correct 79 ms 5604 KB Output is correct
64 Correct 80 ms 5624 KB Output is correct
65 Correct 80 ms 5496 KB Output is correct
66 Correct 80 ms 5624 KB Output is correct
67 Correct 80 ms 5596 KB Output is correct
68 Correct 79 ms 5500 KB Output is correct
69 Correct 81 ms 5600 KB Output is correct
70 Correct 78 ms 5548 KB Output is correct
71 Correct 79 ms 5628 KB Output is correct
72 Correct 79 ms 5564 KB Output is correct
73 Correct 80 ms 5624 KB Output is correct