# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
282282 | MKopchev | Sparklers (JOI17_sparklers) | C++14 | 11 ms | 4736 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int nmax=1e3+42,inf=1e9;
int n,k,t,inp[nmax];
int mem[nmax][nmax];
int cur_v;
int ask(int l,int r)
{
if(k<l||k>r)return 0;
if(l==r)return 1;
if(mem[l][r]!=-1)return mem[l][r];
if(inp[r]-inp[l]<=2LL*(r-l)*t*cur_v)
{
if(ask(l,r-1))mem[l][r]=1;
else if(ask(l+1,r))mem[l][r]=1;
}
else mem[l][r]=0;
//cout<<l<<" "<<r<<" -> "<<mem[l][r]<<endl;
return mem[l][r];
}
bool test(int v)
{
//cout<<"v= "<<v<<endl;
memset(mem,-1,sizeof(mem));
cur_v=v;
return ask(1,n);
}
int main()
{
scanf("%i%i%i",&n,&k,&t);
for(int i=1;i<=n;i++)scanf("%i",&inp[i]);
int ok=inf/t+1,not_ok=-1;
while(ok-not_ok>1)
{
int av=(ok+not_ok)/2;
if(test(av))ok=av;
else not_ok=av;
}
printf("%i\n",ok);
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... |