Submission #659091

# Submission time Handle Problem Language Result Execution time Memory
659091 2022-11-16T13:34:41 Z Alenygam Radio Towers (IOI22_towers) C++17
0 / 100
12 ms 1960 KB
#include "towers.h"

#include <bits/stdc++.h>

using namespace std;

int N;
vector<pair<int, int>> H;
int k;

void init(int N, vector<int> H) {
	::N = N;
	for (int i = 0; i < N; i++) {
		::H[i].first = H[i];
		::H[i].second = i;
	}
	if (N == 2) {
		if (H[0] > H[1]) k = 0;
		else k = 1;
	}

	for (int i = 1; i < N - 1; i++) {
		if (H[i - 1] < H[i] && H[i] > H[i - 1]) k = i;
	}
}

int max_towers(int L, int R, int D) {
	if (k >= L && k <= R) {
		int lf = H[L].first;
		int rg = H[R].first;
		int ma = max(lf, rg);

		if (H[k].first - ma >= D) return 2;
		return 1;
	} else {
		return 1;
	}
}
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1360 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 1960 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 720 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 1360 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -