Submission #1032462

# Submission time Handle Problem Language Result Execution time Memory
1032462 2024-07-23T19:39:50 Z Mr_Husanboy Radio Towers (IOI22_towers) C++17
14 / 100
685 ms 1880 KB
#include "towers.h"
#include <bits/stdc++.h>

using namespace std;


#define ff first
#define ss second
#define all(a) (a).begin(), (a).end()
#define ll long long

template<typename T>
int len(T &a){
    return a.size();
}

int n;
vector<int> h;

int mx = 0;

struct SegTree{
  int n;
  vector<int> t;
  SegTree(int n) : n(n), t(2 * n){}
  SegTree(){}

  int merge(int a, int b){
    return max(a, b);
  }

  void upd(int i, int x){
    i += n;
    t[i] = max(t[i], x);
    for(i /= 2; i > 0; i /= 2){
      t[i] = merge(t[i * 2], t[i * 2 + 1]);
    }
  }

  int get(int l, int r){
    l += n; r += n;
    int res = 0;
    while(l <= r){
      if(l & 1){
        res = merge(res, t[l ++]);
      }
      if(!(r & 1)) res = merge(res, t[r --]); 
      l /= 2;
      r /= 2;
    }
    return res;
  }
};
vector<int> pref;

void init(int N, std::vector<int> H) {
  n = N;
  h = H;
  pref.resize(n);
  for(int i = 1; i < n - 1; i ++){
    if(h[i] > h[i - 1] && h[i] > h[i + 1]) pref[i] = 1;
  }
  for(int i = 1; i < n; i ++) pref[i] += pref[i - 1];
}

int max_towers(int l, int r, int d) {
  if(l == r) return 1;
  return pref[r - 1] - pref[l] + 1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 288 ms 1368 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 0 ms 344 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 0 ms 344 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 511 ms 1880 KB Output is correct
2 Correct 591 ms 1880 KB Output is correct
3 Correct 685 ms 1880 KB Output is correct
4 Correct 641 ms 1880 KB Output is correct
5 Correct 590 ms 1880 KB Output is correct
6 Correct 635 ms 1880 KB Output is correct
7 Correct 648 ms 1880 KB Output is correct
8 Correct 588 ms 1880 KB Output is correct
9 Correct 679 ms 1880 KB Output is correct
10 Correct 660 ms 1880 KB Output is correct
11 Correct 659 ms 1880 KB Output is correct
12 Correct 685 ms 1880 KB Output is correct
13 Correct 636 ms 1880 KB Output is correct
14 Correct 1 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 1880 KB Output is correct
18 Correct 15 ms 1880 KB Output is correct
19 Correct 9 ms 1880 KB Output is correct
20 Correct 14 ms 1880 KB Output is correct
21 Correct 13 ms 1880 KB Output is correct
22 Correct 9 ms 1880 KB Output is correct
23 Correct 16 ms 1880 KB Output is correct
24 Correct 15 ms 1880 KB Output is correct
25 Correct 9 ms 1880 KB Output is correct
26 Correct 13 ms 1880 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 175 ms 776 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 0 ms 344 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 288 ms 1368 KB 2nd lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -