Submission #61045

# Submission time Handle Problem Language Result Execution time Memory
61045 2018-07-25T06:45:59 Z 노영훈(#1760) Broken Device (JOI17_broken_device) C++11
0 / 100
7 ms 1320 KB
#include "Annalib.h"
#include <vector>
#include <iostream>
using namespace std;
typedef long long ll;

static int N;

void my_set(int pos, int val){
    if(pos<0 || N-1<pos || val<0 || 1<val) return;
    Set(pos, val);
}

void Anna(int _N, ll X, int K, int P[]){
    N=_N;

    ll F[100]={}, S[100]={};
    F[0]=1, F[1]=2, S[0]=1;
    for(int i=2; i<=85; i++) F[i]=F[i-1]+F[i-2];
    for(int i=1; i<=85; i++) S[i]=S[i-1]+F[i];

    bool out[150]={};
    for(int i=0; i<K; i++) out[P[i]]=true;
    for(int i=0; i<N/2; i++) if(out[i*2] || out[i*2+1]) out[i*2]=out[i*2+1]=true;

    int Y[100]={}; ll Z=X;
    for(int i=84; i>=0; i--){
        if(S[i]<Z) Y[i+1]=1, Z-=F[i+1];
    }
    if(Z!=0) Y[0]=1;

    // cout<<X<<": \n";
    // for(int i=0; i<86; i++) cout<<Y[i];
    // cout<<'\n';

    for(int i=0, j=0; i<N; i++){
        if(out[i]) { my_set(i, 0); continue; }
        my_set(i, Y[j++]);
    }
}
#include "Brunolib.h"
#include <vector>
using namespace std;
typedef long long ll;

ll Bruno(int N, int A[]){

    ll F[100]={}, S[100]={};
    F[0]=1, F[1]=2, S[0]=1;
    for(int i=2; i<=86; i++) F[i]=F[i-1]+F[i-2];
    for(int i=1; i<=86; i++) S[i]=S[i-1]+F[i];

    bool out[150]={};
    for(int i=0; i<N/2; i++) if(A[i*2]==0 || A[i*2+1]==0) out[i*2]=out[i*2+1]=true;
    
    int Y[150]={}; ll Z=0;
    for(int i=0, j=0; i<N; i++){
        if(out[i]) continue;
        Y[j++]=A[i];
    }

    for(int i=85; i>=0; i--){
        Z+=Y[i]*F[i];
    }
    return Z;
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 856 KB Wrong Answer [4]
2 Incorrect 5 ms 960 KB Wrong Answer [4]
3 Incorrect 5 ms 960 KB Wrong Answer [4]
4 Incorrect 5 ms 960 KB Wrong Answer [4]
5 Incorrect 5 ms 960 KB Wrong Answer [4]
6 Incorrect 6 ms 1080 KB Wrong Answer [4]
7 Incorrect 7 ms 1232 KB Wrong Answer [4]
8 Incorrect 4 ms 1232 KB Wrong Answer [4]
9 Incorrect 4 ms 1232 KB Wrong Answer [4]
10 Incorrect 4 ms 1232 KB Wrong Answer [4]
11 Incorrect 6 ms 1280 KB Wrong Answer [4]
12 Incorrect 5 ms 1280 KB Wrong Answer [4]
13 Incorrect 6 ms 1280 KB Wrong Answer [4]
14 Incorrect 5 ms 1280 KB Wrong Answer [4]
15 Incorrect 4 ms 1280 KB Wrong Answer [4]
16 Incorrect 4 ms 1280 KB Wrong Answer [4]
17 Incorrect 6 ms 1280 KB Wrong Answer [4]
18 Incorrect 5 ms 1280 KB Wrong Answer [4]
19 Incorrect 5 ms 1280 KB Wrong Answer [4]
20 Incorrect 6 ms 1280 KB Wrong Answer [4]
21 Incorrect 5 ms 1280 KB Wrong Answer [4]
22 Incorrect 6 ms 1280 KB Wrong Answer [4]
23 Incorrect 5 ms 1280 KB Wrong Answer [4]
24 Incorrect 5 ms 1280 KB Wrong Answer [4]
25 Incorrect 7 ms 1280 KB Wrong Answer [4]
26 Incorrect 5 ms 1280 KB Wrong Answer [4]
27 Incorrect 6 ms 1280 KB Wrong Answer [4]
28 Incorrect 5 ms 1280 KB Wrong Answer [4]
29 Incorrect 4 ms 1280 KB Wrong Answer [4]
30 Incorrect 4 ms 1292 KB Wrong Answer [4]
31 Incorrect 5 ms 1304 KB Wrong Answer [4]
32 Incorrect 4 ms 1304 KB Wrong Answer [4]
33 Incorrect 7 ms 1304 KB Wrong Answer [4]
34 Incorrect 6 ms 1304 KB Wrong Answer [4]
35 Incorrect 5 ms 1304 KB Wrong Answer [4]
36 Incorrect 2 ms 1304 KB Wrong Answer [4]
37 Incorrect 4 ms 1304 KB Wrong Answer [4]
38 Incorrect 5 ms 1304 KB Wrong Answer [4]
39 Incorrect 7 ms 1304 KB Wrong Answer [4]
40 Incorrect 4 ms 1320 KB Wrong Answer [4]