# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
765837 | yusuf12360 | 구경하기 (JOI13_watching) | C++14 | 539 ms | 15340 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
vector<int> a;
int n, p, q;
bool can(int w) {
vector<vector<int>> dp(n, vector<int>(p+1));
vector<int> small_dist(n), big_dist(n);
int SMALL=0, BIG=0;
for(int i=0; i<n; i++) {
if(a[0]>=a[i]-w+1) small_dist[i]=-1;
else {
while(a[SMALL]<a[i]-w+1) SMALL++;
small_dist[i]=--SMALL;
}
if(a[0]>=a[i]-2*w+1) big_dist[i]=-1;
else {
while(a[BIG]<a[i]-2*w+1) BIG++;
big_dist[i]=--BIG;
}
}
for(auto &p : dp) for(int &pp : p) pp=1e4;
dp[0][0]=1;
for(int i=1; i<=p; i++) dp[0][1]=0;
for(int i=1; i<n; i++) {
for(int j=0; j<=p; j++) {
SMALL=small_dist[i], BIG=big_dist[i];
if(j) {
if(SMALL==-1) dp[i][j]=0;
else dp[i][j]=min(dp[i][j], dp[SMALL][j-1]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |