# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
582112 | 2022-06-23T11:47:19 Z | urd05 | Sparklers (JOI17_sparklers) | C++17 | 5 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])/s>=2LL*t*(r-l+1)){ ret|=ans(l-1,r); } if (r!=n-1&&(arr[r+1]-arr[l])/s>=2LL*t*(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=0; 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 | 5 ms | 4180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 4180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 4180 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |