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
int main()
{
int n;
cin >> n;
int height[n + 5];
int targets[n + 5];
for(int i = 0; i < n; i++)
{
cin >> height[i];
}
for(int i = 0; i < n; i++)
{
cin >> targets[i];
}
int target = targets[0];
int temp = 0;
ll res = 0;
int ok = 0;
for(int i = 0; i < n; i++)
{
if(height[i] < target)
{
if(ok == 0)
{
temp++;
}
else
{
res++;
}
}
else if(height[i] > target)
{
ok = 0;
temp = 0;
}
else if(height[i] == target)
{
res += temp;
ok = 1;
res++;
}
}
cout << res << 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... |