#include <bits/stdc++.h>
#define xx first
#define yy second
using namespace std;
typedef pair<int,int> pii;
int main()
{
int n;
cin>>n;
vector<pii> niz(n);
int maxi=0;
int mini=INT_MAX;
for(int i=0;i<n;i++) cin>>niz[i].xx;
for(int i=0;i<n;i++) cin>>niz[i].yy,mini=min(mini,niz[i].yy),maxi=max(maxi,niz[i].yy);
if(mini==maxi){
int ima=false;
int res=0;
int koliko=0;
for(int i=0;i<n;i++){
if(niz[i].yy<niz[i].xx) res+=(ima ? koliko:0),ima=false,koliko=0;
if(niz[i].yy<niz[i].xx) continue;
koliko++;
if(niz[i].yy==niz[i].xx) ima=true;
}
res+=(ima ? koliko:0);
cout<<res;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
17 ms |
876 KB |
Output is correct |
3 |
Correct |
53 ms |
2028 KB |
Output is correct |
4 |
Correct |
34 ms |
1516 KB |
Output is correct |
5 |
Correct |
88 ms |
3308 KB |
Output is correct |
6 |
Correct |
37 ms |
1516 KB |
Output is correct |
7 |
Correct |
40 ms |
1644 KB |
Output is correct |
8 |
Correct |
85 ms |
3052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
492 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |