QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#440067#362. Sparklersltunjic0 2ms5592kbC++14767b2024-06-13 03:50:592024-06-13 03:50:59

Judging History

你现在查看的是最新测评结果

  • [2024-06-13 03:50:59]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:5592kb
  • [2024-06-13 03:50:59]
  • 提交

answer

#include <cstdio> 
#include <algorithm>
#include <cstring>

using namespace std; 

typedef long long ll;

const int N = 1010;
const int OO = 2e9 + 10;

int n, t, k, X[N];

int dp[N][N];

bool solve(int l, int r, int s) {
	if(l < 0 || r >= n || X[r] - X[l] > (ll) (r - l) * t * 2 * s) { return 0; } 
	if(dp[l][r] != -1) { return 1; }

	return dp[l][r] = solve(l - 1, r, s) | solve(l, r + 1, s);
}

int main() { 
	scanf("%d%d%d", &n, &k, &t);
	for(int i = 0; i < n; ++i) { scanf("%d", X + i); }
	
	int lo = -1, hi = OO;
	for(int mi = (lo + hi) / 2; hi - lo > 1; mi = (lo + hi) / 2) {
		memset(dp, -1, sizeof(dp)); dp[0][n - 1] = 1;
		if(solve(k - 1, k - 1, mi)) { hi = mi; }
		else { lo = mi; }
	}

	printf("%d\n", hi);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 5592kb

input:

10 9 2
0
1117660
2284171
3390084
3568342
4222750
5180454
6186411
6360445
6519656

output:

43509

result:

wrong answer 1st lines differ - expected: '181102', found: '43509'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%