#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include <bits/stdc++.h>
using namespace std;
#ifndef WAIMAI
#include "towers.h"
#else
#include "stub.cpp"
#endif
#ifdef WAIMAI
#define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE)
void dout() {cout << '\n';}
template<typename T, typename...U>
void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);}
#else
#define debug(...) 7122
#endif
#define ll long long
#define Waimai ios::sync_with_stdio(false), cin.tie(0)
#define FOR(x,a,b) for (int x = a, I = b; x <= I; x++)
#define pb emplace_back
#define F first
#define S second
const int SIZE = 1e5 + 5;
int n;
int a[SIZE], pre[SIZE];
void init(int N, vector<int> H) {
n = N;
FOR (i, 1, n) a[i] = H[i - 1];
FOR (i, 2, n - 1) pre[i] = pre[i - 1] + (a[i] < min(a[i - 1], a[i + 1]));
}
int max_towers(int L, int R, int D) {
L++, R++;
if (L == R) return 1;
int ans = pre[R - 1] - pre[L];
ans += (a[L] < a[L + 1]);
ans += (a[R] < a[R - 1]);
return ans;
}
/*
in1
7 3
10 20 60 40 50 30 70
1 5 10
2 2 100
0 6 17
out1
3
1
2
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
248 ms |
1368 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
465 ms |
1880 KB |
Output is correct |
2 |
Correct |
595 ms |
1848 KB |
Output is correct |
3 |
Correct |
530 ms |
1844 KB |
Output is correct |
4 |
Correct |
535 ms |
1880 KB |
Output is correct |
5 |
Correct |
536 ms |
1864 KB |
Output is correct |
6 |
Correct |
581 ms |
1840 KB |
Output is correct |
7 |
Correct |
599 ms |
1880 KB |
Output is correct |
8 |
Correct |
541 ms |
2132 KB |
Output is correct |
9 |
Correct |
519 ms |
1864 KB |
Output is correct |
10 |
Correct |
551 ms |
1880 KB |
Output is correct |
11 |
Correct |
610 ms |
1880 KB |
Output is correct |
12 |
Correct |
550 ms |
1880 KB |
Output is correct |
13 |
Correct |
637 ms |
1880 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
9 ms |
1868 KB |
Output is correct |
18 |
Correct |
16 ms |
1864 KB |
Output is correct |
19 |
Correct |
9 ms |
1880 KB |
Output is correct |
20 |
Correct |
10 ms |
1880 KB |
Output is correct |
21 |
Correct |
8 ms |
1980 KB |
Output is correct |
22 |
Correct |
9 ms |
1864 KB |
Output is correct |
23 |
Correct |
10 ms |
1880 KB |
Output is correct |
24 |
Correct |
9 ms |
1976 KB |
Output is correct |
25 |
Correct |
14 ms |
1880 KB |
Output is correct |
26 |
Correct |
18 ms |
1880 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
444 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
183 ms |
600 KB |
1st lines differ - on the 1st token, expected: '7197', found: '8004' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
248 ms |
1368 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |