답안 #825032

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
825032 2023-08-14T13:44:52 Z becaido 송신탑 (IOI22_towers) C++17
11 / 100
4000 ms 1488 KB
#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"
#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];

void init(int N, vector<int> H) {
    n = N;
    FOR (i, 0, n - 1) a[i] = H[i];
}

int dp[SIZE];
int max_towers(int L, int R, int D) {
    FOR (i, L, R) {
        int mx = 0, h = 0;
        for (int j = i - 1; j >= L; j--) {
            if (h - D >= max(a[i], a[j])) mx = max(mx, dp[j]);
            h = max(h, a[j]);
        }
        dp[i] = mx + 1;
    }
    return *max_element(dp + L, dp + R + 1);
}

/*
in1
7 3
10 20 60 40 50 30 70
1 5 10
2 2 100
0 6 17
out1
3
1
2
*/

#ifdef WAIMAI
int main() {
  int N, Q;
  assert(2 == scanf("%d %d", &N, &Q));
  vector<int> H(N);
  for (int i = 0; i < N; ++i) {
    assert(1 == scanf("%d", &H[i]));
  }
  init(N, H);

  for (int i = 0; i < Q; ++i) {
    int L, R, D;
    assert(3 == scanf("%d %d %d", &L, &R, &D));
    printf("%d\n", max_towers(L, R, D));
  }
  return 0;
}
#endif
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4035 ms 1120 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 2 ms 336 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
21 Correct 3 ms 336 KB Output is correct
22 Correct 2 ms 208 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 2 ms 336 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 2 ms 208 KB Output is correct
27 Correct 2 ms 336 KB Output is correct
28 Correct 2 ms 336 KB Output is correct
29 Correct 2 ms 336 KB Output is correct
30 Correct 3 ms 208 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 2 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 2 ms 208 KB Output is correct
35 Correct 2 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 2 ms 336 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
21 Correct 3 ms 336 KB Output is correct
22 Correct 2 ms 208 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 2 ms 336 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 2 ms 208 KB Output is correct
27 Correct 2 ms 336 KB Output is correct
28 Correct 2 ms 336 KB Output is correct
29 Correct 2 ms 336 KB Output is correct
30 Correct 3 ms 208 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 2 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 2 ms 208 KB Output is correct
35 Correct 2 ms 336 KB Output is correct
36 Correct 140 ms 976 KB Output is correct
37 Correct 610 ms 1456 KB Output is correct
38 Correct 109 ms 1360 KB Output is correct
39 Correct 400 ms 1452 KB Output is correct
40 Correct 77 ms 1452 KB Output is correct
41 Correct 2810 ms 1468 KB Output is correct
42 Correct 19 ms 1488 KB Output is correct
43 Correct 886 ms 1476 KB Output is correct
44 Correct 72 ms 1480 KB Output is correct
45 Correct 11 ms 1456 KB Output is correct
46 Correct 10 ms 1464 KB Output is correct
47 Correct 478 ms 1456 KB Output is correct
48 Correct 281 ms 1476 KB Output is correct
49 Correct 31 ms 1476 KB Output is correct
50 Correct 167 ms 1480 KB Output is correct
51 Correct 577 ms 1340 KB Output is correct
52 Execution timed out 4066 ms 1488 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4026 ms 1460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4030 ms 648 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 1 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 2 ms 336 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 208 KB Output is correct
20 Correct 2 ms 208 KB Output is correct
21 Correct 3 ms 336 KB Output is correct
22 Correct 2 ms 208 KB Output is correct
23 Correct 2 ms 336 KB Output is correct
24 Correct 2 ms 336 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 2 ms 208 KB Output is correct
27 Correct 2 ms 336 KB Output is correct
28 Correct 2 ms 336 KB Output is correct
29 Correct 2 ms 336 KB Output is correct
30 Correct 3 ms 208 KB Output is correct
31 Correct 2 ms 336 KB Output is correct
32 Correct 2 ms 208 KB Output is correct
33 Correct 3 ms 208 KB Output is correct
34 Correct 2 ms 208 KB Output is correct
35 Correct 2 ms 336 KB Output is correct
36 Correct 140 ms 976 KB Output is correct
37 Correct 610 ms 1456 KB Output is correct
38 Correct 109 ms 1360 KB Output is correct
39 Correct 400 ms 1452 KB Output is correct
40 Correct 77 ms 1452 KB Output is correct
41 Correct 2810 ms 1468 KB Output is correct
42 Correct 19 ms 1488 KB Output is correct
43 Correct 886 ms 1476 KB Output is correct
44 Correct 72 ms 1480 KB Output is correct
45 Correct 11 ms 1456 KB Output is correct
46 Correct 10 ms 1464 KB Output is correct
47 Correct 478 ms 1456 KB Output is correct
48 Correct 281 ms 1476 KB Output is correct
49 Correct 31 ms 1476 KB Output is correct
50 Correct 167 ms 1480 KB Output is correct
51 Correct 577 ms 1340 KB Output is correct
52 Execution timed out 4066 ms 1488 KB Time limit exceeded
53 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 4035 ms 1120 KB Time limit exceeded
2 Halted 0 ms 0 KB -