답안 #100102

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
100102 2019-03-09T08:28:43 Z rocketninja7 Broken Device (JOI17_broken_device) C++14
0 / 100
6 ms 512 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-2;i++){
        if(!broken[i]&&!broken[i+1]&&!broken[i+2]){
            available.push_back(i);
            i+=2;
        }
    }
    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<<(2*i))<=X;i++){
        if((1LL<<(2*i))&X){
            val[available[i]+1]=true;
        }
        if((1LL<<(2*i+1))&X){
            val[available[i]+2]=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+=2;
        }
    }
    long long ans=0;
    for(int i=0;i<available.size();i++){
        if(A[available[i]+1]){
            ans+=(1LL<<(2*i));
        }
        if(A[available[i]+2]){
            ans+=(1LL<<(2*i+1));
        }
    }
    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 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 360 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
31 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 3 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 5 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 6 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)