# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
581760 | 2022-06-23T05:54:00 Z | 조영욱(#8367) | Sparklers (JOI17_sparklers) | C++17 | 7 ms | 4216 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]; } __int128 val=2LL*t*(r-l+1); val*=s; val-=arr[r]-arr[l]; int ret=0; if (l!=0&&val>=arr[l]-arr[l-1]){ ret|=ans(l-1,r); } if (r!=n-1&&val>=arr[r+1]-arr[r]) { 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 | Correct | 4 ms | 4180 KB | Output is correct |
2 | Correct | 5 ms | 4180 KB | Output is correct |
3 | Correct | 5 ms | 4180 KB | Output is correct |
4 | Correct | 5 ms | 4180 KB | Output is correct |
5 | Correct | 4 ms | 4180 KB | Output is correct |
6 | Correct | 5 ms | 4180 KB | Output is correct |
7 | Correct | 5 ms | 4212 KB | Output is correct |
8 | Correct | 4 ms | 4180 KB | Output is correct |
9 | Correct | 7 ms | 4212 KB | Output is correct |
10 | Correct | 7 ms | 4216 KB | Output is correct |
11 | Correct | 7 ms | 4180 KB | Output is correct |
12 | Correct | 7 ms | 4180 KB | Output is correct |
13 | Correct | 5 ms | 4180 KB | Output is correct |
14 | Correct | 4 ms | 4180 KB | Output is correct |
15 | Correct | 5 ms | 4180 KB | Output is correct |
16 | Correct | 5 ms | 4180 KB | Output is correct |
17 | Correct | 7 ms | 4192 KB | Output is correct |
18 | Correct | 5 ms | 4180 KB | Output is correct |
19 | Incorrect | 5 ms | 4212 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4180 KB | Output is correct |
2 | Correct | 5 ms | 4180 KB | Output is correct |
3 | Correct | 5 ms | 4180 KB | Output is correct |
4 | Correct | 5 ms | 4180 KB | Output is correct |
5 | Correct | 4 ms | 4180 KB | Output is correct |
6 | Correct | 5 ms | 4180 KB | Output is correct |
7 | Correct | 5 ms | 4212 KB | Output is correct |
8 | Correct | 4 ms | 4180 KB | Output is correct |
9 | Correct | 7 ms | 4212 KB | Output is correct |
10 | Correct | 7 ms | 4216 KB | Output is correct |
11 | Correct | 7 ms | 4180 KB | Output is correct |
12 | Correct | 7 ms | 4180 KB | Output is correct |
13 | Correct | 5 ms | 4180 KB | Output is correct |
14 | Correct | 4 ms | 4180 KB | Output is correct |
15 | Correct | 5 ms | 4180 KB | Output is correct |
16 | Correct | 5 ms | 4180 KB | Output is correct |
17 | Correct | 7 ms | 4192 KB | Output is correct |
18 | Correct | 5 ms | 4180 KB | Output is correct |
19 | Incorrect | 5 ms | 4212 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 4180 KB | Output is correct |
2 | Correct | 5 ms | 4180 KB | Output is correct |
3 | Correct | 5 ms | 4180 KB | Output is correct |
4 | Correct | 5 ms | 4180 KB | Output is correct |
5 | Correct | 4 ms | 4180 KB | Output is correct |
6 | Correct | 5 ms | 4180 KB | Output is correct |
7 | Correct | 5 ms | 4212 KB | Output is correct |
8 | Correct | 4 ms | 4180 KB | Output is correct |
9 | Correct | 7 ms | 4212 KB | Output is correct |
10 | Correct | 7 ms | 4216 KB | Output is correct |
11 | Correct | 7 ms | 4180 KB | Output is correct |
12 | Correct | 7 ms | 4180 KB | Output is correct |
13 | Correct | 5 ms | 4180 KB | Output is correct |
14 | Correct | 4 ms | 4180 KB | Output is correct |
15 | Correct | 5 ms | 4180 KB | Output is correct |
16 | Correct | 5 ms | 4180 KB | Output is correct |
17 | Correct | 7 ms | 4192 KB | Output is correct |
18 | Correct | 5 ms | 4180 KB | Output is correct |
19 | Incorrect | 5 ms | 4212 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |