# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582119 | 2022-06-23T11:52:49 Z | urd05 | Sparklers (JOI17_sparklers) | C++17 | 6 ms | 4180 KB |
#include <bits/stdc++.h> using namespace std; int n,k,t; long long arr[100000]; int dp[1000][1000]; long long s; int ans(int l,int r) { if (l==0&&r==n-1) { return 1; } if (dp[l][r]!=-1) { return dp[l][r]; } int ret=0; if (l!=0&&(arr[r]-arr[l-1])/t>=2LL*s*(r-l+1)){ ret|=ans(l-1,r); } if (r!=n-1&&(arr[r+1]-arr[l])/t>=2LL*s*(r-l+1)) { ret|=ans(l,r+1); } return dp[l][r]=ret; } bool isp(long long x) { s=x; memset(dp,-1,sizeof(dp)); return ans(k,k); } int main(void) { scanf("%d %d %d",&n,&k,&t); k--; for(int i=0;i<n;i++){ scanf("%lld",&arr[i]); } long long lo=-1; long long hi=1e9; //possible while (lo+1<hi) { long long mid=(lo+hi)/2; if (isp(mid)) { hi=mid; } else { lo=mid; } } printf("%lld",hi); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 4180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 4180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 4180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |