#include <bits/stdc++.h>
using namespace std;
const int NMAX = 1e5;
int n;
int a[NMAX + 5], b[NMAX + 5];
bitset<NMAX + 5>vis;
int main()
{
cin >> n;
for (int i=1; i<=n; i++)
cin >> a[i];
for (int i=1; i<=n; i++)
cin >> b[i];
/// b[1] = b[2] = ... = b[n]
/// putem face a[i] = B?
bool go = false;
for (int i=1; i<=n; i++)
{
if (a[i] > b[1])
go = false;
else if (a[i] == b[1])
go = true;
if (go)
vis[i] = true;
}
go = false;
for (int i=n; i>0; i--)
{
if (a[i] > b[1])
go = false;
else if (a[i] == b[1])
go = true;
if (go)
vis[i] = true;
}
cout << (int)vis.count();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 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 |
16 ms |
828 KB |
Output is correct |
3 |
Correct |
45 ms |
1932 KB |
Output is correct |
4 |
Correct |
32 ms |
1404 KB |
Output is correct |
5 |
Correct |
89 ms |
3148 KB |
Output is correct |
6 |
Correct |
28 ms |
1468 KB |
Output is correct |
7 |
Correct |
29 ms |
1612 KB |
Output is correct |
8 |
Correct |
72 ms |
2996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |