답안 #1061997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1061997 2024-08-16T16:41:30 Z oscar1f Sparklers (JOI17_sparklers) C++17
50 / 100
22 ms 1624 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long

const int TAILLE_MAX=1000+5,INFINI=1000*1000*1000;
int nbVal,posInit,tempsInit;
int val[TAILLE_MAX];
bool fonctionne[TAILLE_MAX][TAILLE_MAX];

bool verif(int temps) {
    for (int i=1;i<=nbVal;i++) {
        for (int j=i;j<=nbVal;j++) {
            fonctionne[i][j]=false;
        }
    }
    int fin;
    fonctionne[posInit][posInit]=true;
    for (int taille=2;taille<=nbVal;taille++) {
        for (int deb=1;deb+taille-1<=nbVal;deb++) {
            fin=deb+taille-1;
            if ((fonctionne[deb][fin-1] or fonctionne[deb+1][fin]) and 2*(taille-1)*temps>=val[fin]-val[deb]) {
                fonctionne[deb][fin]=true;
            }
        }
    }
    return fonctionne[1][nbVal];
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>nbVal>>posInit>>tempsInit;
    for (int i=1;i<=nbVal;i++) {
        cin>>val[i];
    }
    int deb=0,fin=INFINI,mid;
    while (deb!=fin) {
        mid=(deb+fin)/2;
        if (verif(mid)) {
            fin=mid;
        }
        else {
            deb=mid+1;
        }
    }
    cout<<(deb+tempsInit-1)/tempsInit<<endl;
    return 0;
}
 
# 결과 실행 시간 메모리 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 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 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 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 9 ms 1116 KB Output is correct
23 Correct 6 ms 856 KB Output is correct
24 Correct 8 ms 1116 KB Output is correct
25 Correct 15 ms 1464 KB Output is correct
26 Correct 18 ms 1372 KB Output is correct
27 Correct 16 ms 1372 KB Output is correct
28 Correct 22 ms 1464 KB Output is correct
29 Correct 15 ms 1368 KB Output is correct
30 Correct 16 ms 1372 KB Output is correct
31 Correct 16 ms 1372 KB Output is correct
32 Correct 17 ms 1468 KB Output is correct
33 Correct 16 ms 1368 KB Output is correct
34 Correct 16 ms 1464 KB Output is correct
35 Correct 16 ms 1372 KB Output is correct
36 Correct 15 ms 1368 KB Output is correct
37 Correct 17 ms 1372 KB Output is correct
38 Correct 16 ms 1372 KB Output is correct
39 Correct 15 ms 1368 KB Output is correct
40 Correct 16 ms 1624 KB Output is correct
# 결과 실행 시간 메모리 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 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 9 ms 1116 KB Output is correct
23 Correct 6 ms 856 KB Output is correct
24 Correct 8 ms 1116 KB Output is correct
25 Correct 15 ms 1464 KB Output is correct
26 Correct 18 ms 1372 KB Output is correct
27 Correct 16 ms 1372 KB Output is correct
28 Correct 22 ms 1464 KB Output is correct
29 Correct 15 ms 1368 KB Output is correct
30 Correct 16 ms 1372 KB Output is correct
31 Correct 16 ms 1372 KB Output is correct
32 Correct 17 ms 1468 KB Output is correct
33 Correct 16 ms 1368 KB Output is correct
34 Correct 16 ms 1464 KB Output is correct
35 Correct 16 ms 1372 KB Output is correct
36 Correct 15 ms 1368 KB Output is correct
37 Correct 17 ms 1372 KB Output is correct
38 Correct 16 ms 1372 KB Output is correct
39 Correct 15 ms 1368 KB Output is correct
40 Correct 16 ms 1624 KB Output is correct
41 Runtime error 1 ms 600 KB Execution killed with signal 11
42 Halted 0 ms 0 KB -