# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
55327 | ksun48 | Sparklers (JOI17_sparklers) | C++14 | 37 ms | 5512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
cin.sync_with_stdio(0); cin.tie(0);
LL n, k, t;
cin >> n >> k >> t;
k--;
vector<LL> x(n);
for(int i = 0; i < n; i++){
cin >> x[i];
}
sort(x.begin(), x.end());
LL equal = 1;
for(int i = 0; i < n; i++){
if(x[i] != x[i]){
equal = 0;
}
}
LL s = -1; // cant
LL e = 1000000000;
while(s + 1 < e){
LL m = (s + e) / 2;
LL cover = m * t * 2;
LL dp[n][n];
for(LL i = k; i >= 0; i--){
for(LL j = k; j < n; j++){
dp[i][j] = 0;
if(x[j]-x[i] > (j-i) * cover){
continue;
}
if(i == k && j == k){
dp[i][j] = 1;
continue;
}
if(i < k && dp[i+1][j]){
dp[i][j] = 1;
}
if(j > k && dp[i][j-1]){
dp[i][j] = 1;
}
}
}
if(dp[0][n-1]){
e = m;
} else {
s = m;
}
}
cout << e << '\n';
}
컴파일 시 표준 에러 (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... |