# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
200621 | gs18115 | Sparklers (JOI17_sparklers) | C++14 | 6 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define semicolon ;
#define ryan bear
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18;
int n,k;
ll x[100010];
bool dp[1010][1010];
inline bool able(ll s)
{
for(int i=0;i<n;i++)
dp[i][i]=i==k-1?1:0;
for(int l=1;l<n;l++)
{
for(int i=0;i+l<n;i++)
{
int j=i+l;
dp[i][j]=(dp[i+1][j]||dp[i][j-1])&&x[i]+s*l>=x[j]-s*l;
}
}
return dp[0][n-1];
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll t;
cin>>n>>k>>t;
for(int i=0;i<n;i++)
cin>>x[i];
ll s=1;
ll e=inf;
while(s<e)
{
ll m=s+e>>1;
if(able(m))
e=m;
else
s=m+1;
}
cout<<(s+t-1)/t<<endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |