# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
354637 | 2021-01-22T04:40:09 Z | Lam_lai_cuoc_doi | Sparklers (JOI17_sparklers) | C++17 | 1 ms | 364 KB |
#include <iostream> #include <cstdio> #include <cmath> #include <vector> #define task "" using namespace std; using ll = long long; using ld = long double; const int N = 1e5 + 2; const int Inf = 1e9 + 7; int n, T, k; int x[N]; void Read() { cin >> n >> k >> T; for (int i = 1; i <= n; ++i) cin >> x[i]; } bool Check(int v) { vector<vector<bool>> dp(n + 5, vector<bool>(n + 5)); dp[k][k] = 1; for (int i = 2; i <= n; ++i) for (int j = 1; j <= n - i + 1; ++j) if ((dp[j][j + i - 2] && 2ll * v * T >= (x[j + i - 1] - x[j + i - 2])) || (dp[j + 1][j + i - 1] && 2ll * v * T >= (x[j + 1] - x[j])) || (dp[j + 1][j + i - 1] && 4ll * v * T >= (x[j + 1] - x[j] + x[i + j - 1] - x[i + j - 2]))) dp[j][j + i - 1] = 1; return dp[1][n]; } void Solve() { int l = 0, m, h = 1e9 + 7; while (l <= h) { m = (l + h) / 2; if (!Check(m)) l = m + 1; else h = m - 1; } cout << l; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen(task ".INP", "r")) { freopen(task ".INP", "r", stdin); freopen(task ".OUT", "w", stdout); } Read(); Solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 364 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |