이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const ll INF=1e18+7;
const int LIM=1e5+7;
ll T[LIM], n;
void init(int _n, vector<int>_h) {
	n=_n;
	rep(i, n) T[i]=_h[i];
}
int max_towers(int l, int r, int d) {
	ll akt=1, lst=INF, ans=1;
	while(l<=r) {
		if(akt==1) {
			if(T[l]>lst) {
				lst=T[l];
			} else if(T[l]<=lst-d) {
				lst=T[l];
				++ans;
				akt=0;
			}
		} else {
			if(T[l]<lst) {
				lst=T[l];
			} else if(T[l]>=lst+d) {
				lst=T[l];
				++ans;
				akt=1;
			}
		}
		++l;
	}
	return ans/2;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |