Submission #55328

# Submission time Handle Problem Language Result Execution time Memory
55328 2018-07-07T03:20:16 Z ksun48 Sparklers (JOI17_sparklers) C++14
0 / 100
2 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

int main(){
	cin.sync_with_stdio(0); cin.tie(0);
	LL n, k, t;
	cin >> n >> k >> t;
	k--;
	vector<LL> x(n);
	for(int i = 0; i < n; i++){
		cin >> x[i];
	}		
	LL s = -1; // cant
	LL e = 1000000000;
	while(s + 1 < e){
		LL m = (s + e) / 2;
		vector<LL> y(n);
		for(LL i = 0; i < n; i++){
			y[i] -= m * t * 2 * i;
		}
		LL dp[n][n];
		dp[k][k] = 1;
		for(LL i = k; i >= 0; i--){
			for(LL j = k; j < n; j++){
				dp[i][j] = 0;
				if(y[j] <= y[i]){
					if(i == k && j == k){
						continue;
					}
					if((i < k && dp[i+1][j]) || (j > k && dp[i][j-1])){
						dp[i][j] = 1;
					}
				}
			}
		}
		if(dp[0][n-1]){
			e = m;
		} else {
			s = m;
		}
	}
	cout << e << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -