#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
using namespace std;
const int maxn = 202;
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n), b(n);
for(int & x : a) {
cin >> x;
}
for(int & x : b) {
cin >> x;
}
int x = b[0];
vector<int> pos;
int res = 0;
for(int i = 0; i < n; i++) {
if(a[i] == x) {
res++;
int j = i - 1;
while(j >= 0 and a[j] <= x) {
j--;
res++;
}
j = i + 1;
while(j < n and a[j] <= x) {
j++;
res++;
}
i = j - 1;
}
}
cout << res << endl;
return 0;
}
/*
K = 5
***.
**.*
..*.
**.*
****
*.**
****
**/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
868 KB |
Output is correct |
3 |
Correct |
12 ms |
1996 KB |
Output is correct |
4 |
Correct |
9 ms |
1492 KB |
Output is correct |
5 |
Correct |
17 ms |
3020 KB |
Output is correct |
6 |
Correct |
9 ms |
1488 KB |
Output is correct |
7 |
Correct |
10 ms |
1620 KB |
Output is correct |
8 |
Correct |
17 ms |
3028 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
316 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 |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |