제출 #1219027

#제출 시각아이디문제언어결과실행 시간메모리
1219027bangan송신탑 (IOI22_towers)C++20
0 / 100
4097 ms1572 KiB
// Fuck It We BALL

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

#define chmax(a, b) a = max(a, b)

#define pb push_back
#define ALL(a) a.begin(), a.end()

#define LC (v<<1)
#define RC (LC|1)
#define mid ((l+r) / 2)

const int mxn = 1e5 + 4;

int n;
int h[mxn];

void init(int N, std::vector<int> H) {
	n = N;
	for (int i=0; i<n; i++) h[i+1] = H[i]; 
}

int max_towers(int L, int R, int D) {
	L++; R++;
	int ans = 0;
	for (int i = L; i <= R; i++) {
		int add = 0;
		int MAX = 0;
		for (int j = i+1; j <= R; j++) {
			if (h[i] > h[j]) break;
			if (h[j] <= MAX-D) add = 1;
			chmax(MAX, h[j]);
		}
		for (int j = i-1; j >= L; j--) {
			if (h[i] > h[j]) break;
			if (h[j] <= MAX-D) add = 1;
			chmax(MAX, h[j]);
		}
		ans += add;
	}
	return max(ans, 1);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...