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>
#define ll long long
using namespace std;
bool h[100010];
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int n;
cin >> n;
int a[n],b[n];
for (int i=0; n>i; i++)
{
cin >> a[i];
}
int cnt = 0;
for (int i=0; n>i; i++)
{
cin >> b[i];
if (b[i] == a[i] && h[i] == 0)
{
int j=i;
int y=i;
for (; j>=0; j--)
{
if (a[j] > a[i])
{
break;
}
h[j] = 1;
}
for (; n>y; y++)
{
if (a[y] > a[i])
{
break;
}
h[y] = 1;
}
y--;
cnt += y - j;
}
}
cout << cnt << endl;
return 0;
}
# | 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... |