-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1756.cpp
More file actions
35 lines (35 loc) · 724 Bytes
/
Copy path1756.cpp
File metadata and controls
35 lines (35 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include <string.h>
#include <cstdio>
#include <algorithm>
using namespace std;
intmain(){
ios_base :: sync_with_stdio(false);
cin.tie(NULL);
intd,n;
cin >> d >> n;
intoven[d],depth[d], dough[n];
for(inti=1;i<=d;i++){
cin >> oven[i];
if( i != 1){
depth[i] = min(depth[i-1],oven[i]);
}else{
depth[i] = oven[i];
}
}
for(inti=1;i<=n;i++){
cin >> dough[i];
}
intcount = 1;
for(inti = d; i>0;i--){
if(depth[i] >= dough[count]){
count++;
if(count == n+1){
cout << i;
return 0;
}
}
}
cout << 0;
return 0;
}