#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll N,A[100005],B[100005];
bool case2=true;
int main(){
cin>>N;
for(int i=1;i<=N;i++)
cin>>A[i];
for(int i=1;i<=N;i++)
cin>>B[i];
for(int i=2;i<=N;i++)
if(B[i]!=B[i-1])
case2=false;
if(case2){
int pv=0,res=0;
int imam=0;
for(int i=1;i<=N;i++){
if(A[i]==B[i])
imam=1;
if(A[i]>B[i]){
res+=imam*(i-1-pv);
pv=i;
imam=0;
}
}
res+=imam*(N-pv);
cout<<res<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
15 ms |
988 KB |
Output is correct |
3 |
Correct |
44 ms |
2636 KB |
Output is correct |
4 |
Correct |
27 ms |
2220 KB |
Output is correct |
5 |
Correct |
88 ms |
3768 KB |
Output is correct |
6 |
Correct |
33 ms |
2124 KB |
Output is correct |
7 |
Correct |
31 ms |
2384 KB |
Output is correct |
8 |
Correct |
78 ms |
3772 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |