#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
11 ms |
340 KB |
Output is correct |
3 |
Correct |
35 ms |
1000 KB |
Output is correct |
4 |
Correct |
21 ms |
980 KB |
Output is correct |
5 |
Correct |
59 ms |
1056 KB |
Output is correct |
6 |
Correct |
21 ms |
1068 KB |
Output is correct |
7 |
Correct |
25 ms |
980 KB |
Output is correct |
8 |
Correct |
56 ms |
980 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |