Submission #733190

# Submission time Handle Problem Language Result Execution time Memory
733190 2023-04-30T08:08:08 Z puppy Radio Towers (IOI22_towers) C++17
4 / 100
940 ms 1568 KB
#include "towers.h"

#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
namespace {
    int N, K;
    int H[100005];
    int rH[100005];
}

void init(int N, std::vector<int> H) {
    ::N = N;
    ::K = -1;
    for (int i = 0; i < N; i++) {
        ::H[i] = H[i];
    }
    for (int i = 0; i < N - 1; i++) {
        if (H[i] > H[i+1]) {
            K = i;
            break;
        }
    }
    if (K == -1) K = N - 1;
    for (int i = 0; i < N; i++) rH[i] = H[N-1-i];
}

int max_towers(int L, int R, int D) {
  if (R <= K || K <= L) return 1;
  return (H[L] <= H[K] - D && H[R] <= H[K] - D) ? 2 : 1;
}
# Verdict Execution time Memory Grader output
1 Correct 404 ms 940 KB Output is correct
2 Correct 682 ms 1428 KB Output is correct
3 Correct 940 ms 1444 KB Output is correct
4 Correct 686 ms 1456 KB Output is correct
5 Correct 939 ms 1440 KB Output is correct
6 Correct 919 ms 1568 KB Output is correct
7 Correct 872 ms 1452 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 208 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 208 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 520 ms 1440 KB 1st lines differ - on the 1st token, expected: '11903', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 275 ms 464 KB 1st lines differ - on the 1st token, expected: '7197', found: '1'
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: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 404 ms 940 KB Output is correct
2 Correct 682 ms 1428 KB Output is correct
3 Correct 940 ms 1444 KB Output is correct
4 Correct 686 ms 1456 KB Output is correct
5 Correct 939 ms 1440 KB Output is correct
6 Correct 919 ms 1568 KB Output is correct
7 Correct 872 ms 1452 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Incorrect 1 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '1'
12 Halted 0 ms 0 KB -