Submission #100087

# Submission time Handle Problem Language Result Execution time Memory
100087 2019-03-09T08:21:53 Z rocketninja7 Broken Device (JOI17_broken_device) C++14
0 / 100
4 ms 540 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++;
        }
    }
    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+=2){
        if((1LL<<i)&X){
            val[available[i]+1]=true;
        }
        if((1LL<<(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+=2){
        if(A[available[i]+1]){
            ans+=(1LL<<i);
        }
        if(A[available[i]+2]){
            ans+=(1LL<<(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+=2){
                 ~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 3 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 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 2 ms 384 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 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 3 ms 512 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 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 2 ms 384 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 2 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 3 ms 540 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 4 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 3 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 2 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 3 ms 512 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 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
36 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
37 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
38 Runtime error 3 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Runtime error 2 ms 512 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)