#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int h[maxn];
int t[maxn];
int main() {
int n;
cin >> n;
bool tc2 = true;
for (int i = 1; i <= n; i++) {
cin >> h[i];
}
for (int i = 1; i <= n; i++) {
cin >> t[i];
if (i != 1 && t[i] != t[i-1]) {
tc2 = false;
}
}
if (tc2) {
int accu = 0;
int req = t[1];
int status = 0;
for (int i = 1; i <= n; i++) {
if (h[i] > req) status = 0;
else if (h[i] < req) {
if (status == -1) {
accu++;
} else {
status++;
}
}
else if (h[i] == req) {
if (status != -1) {
accu += status + 1;
status = -1;
} else {
accu++;
}
}
}
cout << accu;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
11 ms |
408 KB |
Output is correct |
3 |
Correct |
39 ms |
976 KB |
Output is correct |
4 |
Correct |
22 ms |
980 KB |
Output is correct |
5 |
Correct |
57 ms |
1008 KB |
Output is correct |
6 |
Correct |
22 ms |
972 KB |
Output is correct |
7 |
Correct |
26 ms |
972 KB |
Output is correct |
8 |
Correct |
55 ms |
996 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 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 |
- |