Submission #627326

# Submission time Handle Problem Language Result Execution time Memory
627326 2022-08-12T12:52:41 Z coloboxx Radio Towers (IOI22_towers) C++17
0 / 100
2712 ms 1444 KB
#include "towers.h"
#include <bits/stdc++.h>

using namespace std;

const int MAXN = 3e5 + 64;

int n;
vector<int> h;

void init(int N, vector<int> H) {
	n = N, h = H;
}

int max_towers(int L, int R, int D) {
	int ans = 0, cur = INT_MAX, flag = false;

	for (int i = L; i <= R; ++i)
		if (!flag) {
			if (h[i] < cur)
				cur = h[i];
			else if (cur - D >= h[i])
				flag = true, cur = h[i];
		} else {
			if (h[i] > cur)
				cur = h[i];
			else if (h[i] - D >= cur) {
				flag = false, ++ans, cur = h[i];
			}
		}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1091 ms 940 KB 1st lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2712 ms 1444 KB 1st lines differ - on the 1st token, expected: '11903', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 914 ms 556 KB 1st lines differ - on the 1st token, expected: '7197', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB 1st lines differ - on the 1st token, expected: '13', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1091 ms 940 KB 1st lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -