# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
581757 | 2022-06-23T05:50:18 Z | 조영욱(#8367) | Sparklers (JOI17_sparklers) | C++17 | 8 ms | 4220 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]; } long long val=2*s*t*(r-l+1); 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4180 KB | Output is correct |
2 | Correct | 8 ms | 4180 KB | Output is correct |
3 | Correct | 7 ms | 4212 KB | Output is correct |
4 | Correct | 6 ms | 4180 KB | Output is correct |
5 | Correct | 6 ms | 4180 KB | Output is correct |
6 | Correct | 6 ms | 4216 KB | Output is correct |
7 | Correct | 7 ms | 4180 KB | Output is correct |
8 | Correct | 6 ms | 4180 KB | Output is correct |
9 | Correct | 6 ms | 4180 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 5 ms | 4180 KB | Output is correct |
12 | Correct | 7 ms | 4180 KB | Output is correct |
13 | Correct | 6 ms | 4180 KB | Output is correct |
14 | Correct | 5 ms | 4180 KB | Output is correct |
15 | Correct | 6 ms | 4180 KB | Output is correct |
16 | Correct | 6 ms | 4180 KB | Output is correct |
17 | Correct | 7 ms | 4220 KB | Output is correct |
18 | Correct | 8 ms | 4100 KB | Output is correct |
19 | Incorrect | 5 ms | 4180 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4180 KB | Output is correct |
2 | Correct | 8 ms | 4180 KB | Output is correct |
3 | Correct | 7 ms | 4212 KB | Output is correct |
4 | Correct | 6 ms | 4180 KB | Output is correct |
5 | Correct | 6 ms | 4180 KB | Output is correct |
6 | Correct | 6 ms | 4216 KB | Output is correct |
7 | Correct | 7 ms | 4180 KB | Output is correct |
8 | Correct | 6 ms | 4180 KB | Output is correct |
9 | Correct | 6 ms | 4180 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 5 ms | 4180 KB | Output is correct |
12 | Correct | 7 ms | 4180 KB | Output is correct |
13 | Correct | 6 ms | 4180 KB | Output is correct |
14 | Correct | 5 ms | 4180 KB | Output is correct |
15 | Correct | 6 ms | 4180 KB | Output is correct |
16 | Correct | 6 ms | 4180 KB | Output is correct |
17 | Correct | 7 ms | 4220 KB | Output is correct |
18 | Correct | 8 ms | 4100 KB | Output is correct |
19 | Incorrect | 5 ms | 4180 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 4180 KB | Output is correct |
2 | Correct | 8 ms | 4180 KB | Output is correct |
3 | Correct | 7 ms | 4212 KB | Output is correct |
4 | Correct | 6 ms | 4180 KB | Output is correct |
5 | Correct | 6 ms | 4180 KB | Output is correct |
6 | Correct | 6 ms | 4216 KB | Output is correct |
7 | Correct | 7 ms | 4180 KB | Output is correct |
8 | Correct | 6 ms | 4180 KB | Output is correct |
9 | Correct | 6 ms | 4180 KB | Output is correct |
10 | Correct | 5 ms | 4180 KB | Output is correct |
11 | Correct | 5 ms | 4180 KB | Output is correct |
12 | Correct | 7 ms | 4180 KB | Output is correct |
13 | Correct | 6 ms | 4180 KB | Output is correct |
14 | Correct | 5 ms | 4180 KB | Output is correct |
15 | Correct | 6 ms | 4180 KB | Output is correct |
16 | Correct | 6 ms | 4180 KB | Output is correct |
17 | Correct | 7 ms | 4220 KB | Output is correct |
18 | Correct | 8 ms | 4100 KB | Output is correct |
19 | Incorrect | 5 ms | 4180 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |