#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int32_t main(){
int n;
cin>>n;
int a[n],b[n],ans[n];
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<n;i++)cin>>b[i];
for(int i=0;i<n;i++)ans[i]=0;
for(int i=0;i<n;i++){
if(a[i]!=b[i])continue;
ans[i]=1;
for(int j=i-1;j>=0;j--){
if(a[j]>=b[j])break;
ans[j]=1;
}
for(int j=i+1;j<n;j++){
if(a[j]>=b[j])break;
ans[j]=1;
}
}
int s=0;
for(int i=0;i<n;i++)s+=ans[i];
cout<<s<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
12 ms |
1132 KB |
Output is correct |
3 |
Correct |
36 ms |
3412 KB |
Output is correct |
4 |
Correct |
22 ms |
3032 KB |
Output is correct |
5 |
Correct |
71 ms |
4612 KB |
Output is correct |
6 |
Correct |
22 ms |
3032 KB |
Output is correct |
7 |
Correct |
25 ms |
3128 KB |
Output is correct |
8 |
Correct |
55 ms |
4540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |