Submission #812168

# Submission time Handle Problem Language Result Execution time Memory
812168 2023-08-07T07:35:35 Z kwongweng Radio Towers (IOI22_towers) C++17
18 / 100
787 ms 2484 KB
#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define fi first
#define se second

int k, n; vi h;
vi cnt(1e5), pre(1e5);

void init(int N, vi H) {
  n=N; h=H;
  FOR(i,1,n-1){
    if (H[i]>max(H[i-1],H[i+1])){
      k=i; cnt[i]++;
    }
  }
  pre[0]=cnt[0];
  FOR(i,1,n) pre[i]=pre[i-1]+cnt[i];
}

int max_towers(int L, int R, int D) {
  if (R-L<=1) return 1;
  if (D==1){
    return pre[R-1] - pre[L] + 1;
  }
  if (L>=k || R<=k) return 1;
  if (max(h[L],h[R]) > h[k]-D) return 1;
  return 2;
}
# Verdict Execution time Memory Grader output
1 Correct 382 ms 1744 KB Output is correct
2 Correct 653 ms 2168 KB Output is correct
3 Correct 556 ms 2244 KB Output is correct
4 Correct 787 ms 2228 KB Output is correct
5 Correct 681 ms 2232 KB Output is correct
6 Correct 479 ms 2232 KB Output is correct
7 Correct 690 ms 2240 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 1104 KB Output is correct
10 Correct 1 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 976 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 976 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 393 ms 2224 KB Output is correct
2 Correct 543 ms 2256 KB Output is correct
3 Correct 516 ms 2256 KB Output is correct
4 Correct 556 ms 2228 KB Output is correct
5 Correct 625 ms 2248 KB Output is correct
6 Correct 658 ms 2232 KB Output is correct
7 Correct 583 ms 2248 KB Output is correct
8 Correct 575 ms 2120 KB Output is correct
9 Correct 581 ms 2256 KB Output is correct
10 Correct 564 ms 2236 KB Output is correct
11 Correct 544 ms 2240 KB Output is correct
12 Correct 668 ms 2484 KB Output is correct
13 Correct 501 ms 2120 KB Output is correct
14 Correct 1 ms 976 KB Output is correct
15 Correct 1 ms 1104 KB Output is correct
16 Correct 1 ms 1104 KB Output is correct
17 Correct 16 ms 2240 KB Output is correct
18 Correct 10 ms 2228 KB Output is correct
19 Correct 11 ms 2240 KB Output is correct
20 Correct 10 ms 2232 KB Output is correct
21 Correct 11 ms 2244 KB Output is correct
22 Correct 11 ms 2252 KB Output is correct
23 Correct 11 ms 2256 KB Output is correct
24 Correct 17 ms 2216 KB Output is correct
25 Correct 10 ms 2240 KB Output is correct
26 Correct 11 ms 2252 KB Output is correct
27 Correct 1 ms 1104 KB Output is correct
28 Correct 1 ms 1104 KB Output is correct
29 Correct 1 ms 1104 KB Output is correct
30 Correct 1 ms 1104 KB Output is correct
31 Correct 1 ms 1104 KB Output is correct
32 Correct 1 ms 1104 KB Output is correct
33 Correct 1 ms 1104 KB Output is correct
34 Correct 1 ms 1104 KB Output is correct
35 Correct 1 ms 1104 KB Output is correct
36 Correct 1 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 164 ms 1360 KB 1st lines differ - on the 1st token, expected: '7197', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 976 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 382 ms 1744 KB Output is correct
2 Correct 653 ms 2168 KB Output is correct
3 Correct 556 ms 2244 KB Output is correct
4 Correct 787 ms 2228 KB Output is correct
5 Correct 681 ms 2232 KB Output is correct
6 Correct 479 ms 2232 KB Output is correct
7 Correct 690 ms 2240 KB Output is correct
8 Correct 1 ms 976 KB Output is correct
9 Correct 1 ms 1104 KB Output is correct
10 Correct 1 ms 1104 KB Output is correct
11 Incorrect 1 ms 976 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
12 Halted 0 ms 0 KB -