#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
const int INF = 2147483645;
const int maxN = (int)5e5+5;
const ll LLINF = LLONG_MAX;
//const ll mod = 998244353;
const ll mod = 1000000007;
void solv() {
int n, a, ans=0;
vector<int> h, t;
cin>>n;
for (int i=0;i<n;i++) cin>>a, h.pb(a);
for (int i=0;i<n;i++) cin>>a, t.pb(a);
for (int i=0;i<n;i++) {
if (h[i] != a) continue;
int tmp = i-1;
while (tmp >= 0 && h[tmp] <= a) {
ans++, tmp--;
}
while (i < n && h[i] <= a) {
ans++, i++;
}
}
cout<<ans<<'\n';
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int t=1;
// cin>>t;
while (t--) solv();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
4 ms |
596 KB |
Output is correct |
3 |
Correct |
11 ms |
1364 KB |
Output is correct |
4 |
Correct |
12 ms |
1492 KB |
Output is correct |
5 |
Correct |
18 ms |
1492 KB |
Output is correct |
6 |
Correct |
9 ms |
1492 KB |
Output is correct |
7 |
Correct |
13 ms |
1536 KB |
Output is correct |
8 |
Correct |
17 ms |
1492 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |