이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define pb push_back
#define pf push_front
#define p push
#define q queue
#define popf pop_front()
#define popb pop_back()
#define dq deque
#define fi first
#define se second
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define pq priority_queue
#define st stack
#define rep(i,a,b) for (ll i=a; i<b; i++)
#define rept(i,a,b) for (ll i=a; i<=b; i++)
#define repr(i,a,b) for (ll i=a; i>=b; i--)
#define ppi pair<ll,ll>
#define test cout<<"A"<<endl
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
// cin.tie(NULL);
ll n;
cin>>n;
ve<ll> H(n);
ve<ll> T(n);
ll sta, end;
sta = n;
end = 0;
rep(i,0,n){
cin>>H[i];
}
ll ans = 0;
rep(i,0,n){
cin>>T[i];
if (T[i] == H[i]){
sta = min(sta, i);
end = max(end, i);
}
}
rept(i, sta, end){
if (H[i] <= T[i]){
ans++;
}
}
repr(i, sta-1, 0){
if (H[i] <= T[i]){
ans++;
}
}
rep(i, end+1, n){
if (H[i] <= T[i]){
ans++;
}
}
cout<<ans<<endl;
return 0;
}
# | 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... |