#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
int const maxin = 1e5+6;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int a;
ll ans = 0;
ll cnt = 0;
cin>>a;
int arr[a];
int arr2[a];
for(int i=0;i<a;i++)
cin>>arr[i];
for(int i=0;i<a;i++)
cin>>arr2[i];
ll x = arr2[0];
bool flag = true ;
for(int i=0;i<a;i++)
{
if(arr[i] == x)
{
ans++;
if(flag == true)
{
flag = false ;
for(int j=i-1;j>=0;j--)
{
if(arr[j] <= x)
ans++;
else
break;
}
}
for(int j=i+1;j<a;j++)
{
cnt = j;
if(arr[j] <= x)
ans++;
else
break;
}
i = cnt+1;
}
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
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 |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |