# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
462317 | bigo | Exam (eJOI20_exam) | C++14 | 89 ms | 1348 KiB |
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 <bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<int, int> pii;
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];
}
vector<int>vec;
for (int i = 0; i < n; i++) {
if (a[i] == b[0])
vec.push_back(i);
}
int ans = 0;
vector<bool>ok(n, false);
for (int i = 0; i < vec.size(); i++) {
if (!ok[vec[i]]) {
for (int j = vec[i]; j >= 0; j--) {
if (a[j] <= b[0])
ok[j] = true;
else
break;
}
for (int j = vec[i]; j <n; j++) {
if (a[j] <= b[0])
ok[j] = true;
else
break;
}
}
}
for (int i = 0; i < n; i++)
if (ok[i])
ans++;
cout << ans;
}
Compilation message (stderr)
# | 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... |