Submission #625453

# Submission time Handle Problem Language Result Execution time Memory
625453 2022-08-10T12:05:06 Z model_code Radio Towers (IOI22_towers) C++17
14 / 100
1198 ms 1872 KB
// incorrect/solution-ayaze-d-one.cpp
#include "towers.h"

#include <bits/stdc++.h>
using namespace std;

int N;
vector<int> H;
vector<int> bottoms;

void init(int _N, std::vector<int> _H) {
  N = _N;
  H = _H;
  for (int i = 1 ; i+1 < N ; i++) {
    if (H[i] < H[i+1] && H[i] < H[i-1]) {
      bottoms.push_back(i);
    }
  }
}

int max_towers(int L, int R, int) {
  if (R-L+1 <= 2) return 1;
  
  int bottom_count = upper_bound(bottoms.begin(), bottoms.end(), R-1) - 
                     lower_bound(bottoms.begin(), bottoms.end(), L+1);
  
  if (bottom_count == 0) {
    if (H[L] < H[L+1] && H[R] < H[R-1]) return 2;
    return 1;
  }

  int ret = bottom_count;

  int l_idx = lower_bound(bottoms.begin(), bottoms.end(), L+1) - bottoms.begin();
  int l = bottoms[l_idx];
  if (l > L+1 && H[L] < H[L+1]) ret++;

  int r_idx = upper_bound(bottoms.begin(), bottoms.end(), R-1) - bottoms.begin() - 1;
  int r = bottoms[r_idx];
  if (r < R-1 && H[R] < H[R-1]) ret++;

  return ret;
}
# Verdict Execution time Memory Grader output
1 Incorrect 667 ms 1016 KB 2nd lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 790 ms 1828 KB Output is correct
2 Correct 1167 ms 1824 KB Output is correct
3 Correct 871 ms 1736 KB Output is correct
4 Correct 1198 ms 1816 KB Output is correct
5 Correct 1094 ms 1824 KB Output is correct
6 Correct 889 ms 1832 KB Output is correct
7 Correct 1168 ms 1872 KB Output is correct
8 Correct 969 ms 1448 KB Output is correct
9 Correct 962 ms 1436 KB Output is correct
10 Correct 753 ms 1424 KB Output is correct
11 Correct 876 ms 1472 KB Output is correct
12 Correct 1149 ms 1488 KB Output is correct
13 Correct 1026 ms 1460 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 216 KB Output is correct
16 Correct 1 ms 256 KB Output is correct
17 Correct 20 ms 1840 KB Output is correct
18 Correct 20 ms 1828 KB Output is correct
19 Correct 22 ms 1852 KB Output is correct
20 Correct 19 ms 1448 KB Output is correct
21 Correct 18 ms 1444 KB Output is correct
22 Correct 20 ms 1844 KB Output is correct
23 Correct 13 ms 1824 KB Output is correct
24 Correct 20 ms 1828 KB Output is correct
25 Correct 14 ms 1444 KB Output is correct
26 Correct 21 ms 1440 KB Output is correct
27 Correct 1 ms 244 KB Output is correct
28 Correct 1 ms 256 KB Output is correct
29 Correct 1 ms 256 KB Output is correct
30 Correct 1 ms 208 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 1 ms 256 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 243 ms 512 KB 1st lines differ - on the 1st token, expected: '7197', found: '8004'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '16'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 667 ms 1016 KB 2nd lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -