[BOJ] 1756 피자 굽기

Time Lapse :57min 0sec

1756.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
int d, n, num, ans;
int o[300001];
int main(void) {
o[0] = 987654321;
scanf("%d %d", &d, &n);
for(int i = 1; i <= d; ++i) {
scanf("%d", &num);
o[i] = o[i - 1] < num ? o[i - 1] : num;
}
ans = d + 1;
for(int i = 0; i < n; ++i) {
if(!ans) break;
scanf("%d", &num);
for(--ans; ans; --ans)
if(o[ans] >= num) break;
}
printf("%d",ans);
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/08/05/PS/BOJ/1756/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.