#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define space ' '
const int N = (int)1e5 + 20;
void Run(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
#endif
}
string s,t;
int main()
{
Run();
//vars&input
int t = 1;
// cin >> t;
while (t--) {
int n;
cin >> n;
int a[N],b[N];
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < n; i++) cin >> b[i];
//operations room
int ans = 0,last_big = -1;
bool temp = 0;
for (int i = 0; i < n; i++) {
if (a[i] == b[0]) {
ans += (i - last_big - 1) * !temp;
temp = 1;
}
else if (a[i] > b[0]) {
last_big = i;
temp = 0;
}
ans += temp;
}
//output
cout << ans;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Correct |
5 ms |
980 KB |
Output is correct |
3 |
Correct |
12 ms |
1104 KB |
Output is correct |
4 |
Correct |
9 ms |
1096 KB |
Output is correct |
5 |
Correct |
21 ms |
1092 KB |
Output is correct |
6 |
Correct |
10 ms |
980 KB |
Output is correct |
7 |
Correct |
10 ms |
1100 KB |
Output is correct |
8 |
Correct |
18 ms |
1092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
980 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
980 KB |
Output is correct |
2 |
Incorrect |
1 ms |
980 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |