This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll sz=100005;
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
ll n;
cin>>n;
ll a[n], b[n];
for(int i=1; i<=n; i++){
cin>>a[i];
}
for(int i=1; i<=n; i++){
cin>>b[i];
}
bool f=1;
ll ans=0, k=0;
for(int i=1; i<=n; i++){
if(a[i]==b[i]){
f=1;
}
if(a[i]<=b[i]){
k++;
}
if(a[i]>b[i] || i==n){
if(f==1){
ans+=k;
k=0;
}
f=0;
}
}
cout<<ans;
}
# | 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... |