#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> a(n), b(n);
for(int i = 0; i < n; i++){
cin >> a[i];
}
for(int i = 0; i < n; i++){
cin >> b[i];
}
bool r[n];
for(int i = 0; i < n; i++) r[i] = 0;
for(int i = 0; i < n; i++){
if(a[i] == b[0]){
r[i] = 1;
int j = i;
while(j > 0 && a[i] > a[j-1]){
j--;
r[j] = 1;
}
j = i;
while(j < n-1 && a[i] > a[j+1]){
j++;
r[j] = 1;
}
}
}
int k = 0;
for(int i = 0; i < n; i++){
if(r[i]) k++;
}
cout << k;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
12 ms |
852 KB |
Output is correct |
3 |
Correct |
37 ms |
2032 KB |
Output is correct |
4 |
Correct |
22 ms |
1460 KB |
Output is correct |
5 |
Correct |
58 ms |
2652 KB |
Output is correct |
6 |
Correct |
22 ms |
1484 KB |
Output is correct |
7 |
Correct |
25 ms |
1708 KB |
Output is correct |
8 |
Correct |
62 ms |
2744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
440 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 |
212 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 |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |