This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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
***.
**.*
..*.
**.*
****
*.**
****
**/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |