답안 #100045

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100045 2019-03-09T07:11:16 Z rocketninja7 Broken Device (JOI17_broken_device) C++14
41 / 100
73 ms 3312 KB
#include "Annalib.h"
#include <vector>
using namespace std;

void Anna( int N, long long X, int K, int P[] ){
    bool broken[N];
    for(int i=0;i<N;i++){
        broken[i]=false;
    }
    for(int i=0;i<K;i++){
        broken[P[i]]=true;
    }
    vector<int> available;
    for(int i=0;i<N-1;i++){
        if(!broken[i]&&!broken[i+1]){
            available.push_back(i);
            i++;
        }
    }
    bool val[N];
    for(int i=0;i<N;i++){
        val[i]=false;
    }
    for(int i=0;i<available.size();i++){
        val[available[i]]=true;
    }
    for(int i=0;(1LL<<i)<=X;i++){
        if((1LL<<i)&X){
            val[available[i]+1]=true;
        }
    }
    for( int i = 0; i < N; i++ ){
        Set( i, val[i]?1:0 );
    }
}
#include "Brunolib.h"
#include <vector>
using namespace std;

long long Bruno( int N, int A[] ){
    vector<int> available;
    for(int i=0;i<N;i++){
        if(A[i]==1){
            available.push_back(i);
            i++;
        }
    }
    long long ans=0;
    for(int i=0;i<available.size();i++){
        if(A[available[i]+1]){
            ans+=(1LL<<i);
        }
    }
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:24:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<available.size();i++){
                 ~^~~~~~~~~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<available.size();i++){
                 ~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 48 ms 3056 KB Output is partially correct - L* = 15
2 Partially correct 51 ms 2816 KB Output is partially correct - L* = 15
3 Partially correct 43 ms 3056 KB Output is partially correct - L* = 17
4 Partially correct 70 ms 3312 KB Output is partially correct - L* = 16
5 Partially correct 50 ms 3056 KB Output is partially correct - L* = 15
6 Partially correct 47 ms 3072 KB Output is partially correct - L* = 15
7 Partially correct 43 ms 2800 KB Output is partially correct - L* = 18
8 Partially correct 45 ms 3072 KB Output is partially correct - L* = 18
9 Partially correct 45 ms 3056 KB Output is partially correct - L* = 16
10 Partially correct 43 ms 3072 KB Output is partially correct - L* = 16
11 Partially correct 43 ms 2816 KB Output is partially correct - L* = 17
12 Partially correct 44 ms 3056 KB Output is partially correct - L* = 17
13 Partially correct 43 ms 3072 KB Output is partially correct - L* = 15
14 Partially correct 38 ms 3056 KB Output is partially correct - L* = 15
15 Partially correct 52 ms 3056 KB Output is partially correct - L* = 16
16 Partially correct 40 ms 3072 KB Output is partially correct - L* = 15
17 Partially correct 41 ms 3056 KB Output is partially correct - L* = 17
18 Partially correct 45 ms 2816 KB Output is partially correct - L* = 16
19 Partially correct 59 ms 3016 KB Output is partially correct - L* = 18
20 Partially correct 44 ms 3072 KB Output is partially correct - L* = 15
21 Partially correct 67 ms 2976 KB Output is partially correct - L* = 15
22 Partially correct 53 ms 2784 KB Output is partially correct - L* = 15
23 Partially correct 57 ms 3000 KB Output is partially correct - L* = 15
24 Partially correct 63 ms 3048 KB Output is partially correct - L* = 17
25 Partially correct 49 ms 3072 KB Output is partially correct - L* = 15
26 Partially correct 48 ms 2816 KB Output is partially correct - L* = 16
27 Partially correct 43 ms 3056 KB Output is partially correct - L* = 15
28 Partially correct 44 ms 3064 KB Output is partially correct - L* = 16
29 Partially correct 47 ms 3056 KB Output is partially correct - L* = 15
30 Partially correct 57 ms 2800 KB Output is partially correct - L* = 16
31 Partially correct 49 ms 3016 KB Output is partially correct - L* = 15
32 Partially correct 73 ms 2800 KB Output is partially correct - L* = 16
33 Partially correct 57 ms 2816 KB Output is partially correct - L* = 15
34 Partially correct 38 ms 2816 KB Output is partially correct - L* = 16
35 Partially correct 57 ms 2816 KB Output is partially correct - L* = 15
36 Partially correct 54 ms 3056 KB Output is partially correct - L* = 15
37 Partially correct 62 ms 2816 KB Output is partially correct - L* = 16
38 Partially correct 43 ms 2800 KB Output is partially correct - L* = 17
39 Partially correct 53 ms 2800 KB Output is partially correct - L* = 15
40 Partially correct 54 ms 2800 KB Output is partially correct - L* = 15