답안 #878963

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878963 2023-11-25T19:59:21 Z eitanelb Sparklers (JOI17_sparklers) C++14
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

bool ok(int n, int k, vector<int>&v, long m){
    bool dp[n][n];
    for(int i=0;i<n;i++)for(int j=0;j<n;j++) dp[i][j]=0;
    dp[k-1][k-1]=1;
    for(int sz=2;sz<=n;sz++){
        for(int i=0;i+sz-1 < n;i++){
            if(((v[i+sz-1]-v[i]) <= 2*m*(sz-1)) && (dp[i][i+sz-2] || dp[i+1][i+sz-1])) dp[i][i+sz-1]=1;
        }
    }
    //cout<<m<<' '<<dp[0][n-1]<<endl;
    return dp[0][n-1];
}
int func(int n, int k, int t, vector<int>&v){
    int s=1, e=1e9, m;
    while(e>s){
        m = (e+s)/2;
        if(ok(n,k,v,m)) e=m;
        else s=m+1;
    }
    return (s+t-1)/t;
}

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n,k,t;
    cin>>n>>k>>t;
    vector<int> v(n);
    for(int i=0;i<n;i++) cin>>v[i];
    
    int res = func(n,k,t,v);
    
    cout<<res<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 456 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Incorrect 0 ms 344 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 456 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Incorrect 0 ms 344 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 600 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 456 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Incorrect 0 ms 344 KB Output isn't correct
20 Halted 0 ms 0 KB -