답안 #59791

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
59791 2018-07-23T06:26:25 Z 윤교준(#1726) Sparklers (JOI17_sparklers) C++11
0 / 100
5 ms 544 KB
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define sz(V) ((int)(V).size())
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;

const int MAXN = 100005;

int A[MAXN];

int N, K, T;

bool isp(int P) {
	int i = K, j = K;
	for(; 1 < i || j < N;) {
		if(1 < i && ll(A[j]) - 2ll * P * T * j <= ll(A[i-1]) - 2ll * P * T * (i-1)) i--;
		else if(j < N && ll(A[j+1]) - 2ll * P * T * (j+1) <= ll(A[i]) - 2ll * P * T * i) j++;
		else break;
	}
	return 1 == i && j == N;
}

int getAns() {
	int s = 0, e = INF/T+2; for(int m; s < e;) {
		m = (s+e) >> 1;
		if(isp(m)) e = m;
		else s = m+1;
	}
	return s;
}

int main() {
	ios::sync_with_stdio(false);

	cin >> N >> K >> T;
	for(int i = 1; i <= N; i++) cin >> A[i];

	cout << getAns() << endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 4 ms 484 KB Output is correct
3 Correct 5 ms 532 KB Output is correct
4 Correct 3 ms 532 KB Output is correct
5 Correct 3 ms 544 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
7 Incorrect 3 ms 544 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 4 ms 484 KB Output is correct
3 Correct 5 ms 532 KB Output is correct
4 Correct 3 ms 532 KB Output is correct
5 Correct 3 ms 544 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
7 Incorrect 3 ms 544 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 4 ms 484 KB Output is correct
3 Correct 5 ms 532 KB Output is correct
4 Correct 3 ms 532 KB Output is correct
5 Correct 3 ms 544 KB Output is correct
6 Correct 3 ms 544 KB Output is correct
7 Incorrect 3 ms 544 KB Output isn't correct
8 Halted 0 ms 0 KB -