이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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++;
temp = 0;
}
}
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... |