Submission #954885

# Submission time Handle Problem Language Result Execution time Memory
954885 2024-03-28T18:37:49 Z leo_2727 Broken Device (JOI17_broken_device) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include <Annalib.h>
typedef long long ll;
using namespace std;
void Anna( int N, ll X, int K, int P[] ){
    int ar[N]={0};
    ll curr=0;
    for(int i=0;i<K;i++)    ar[P[i]]=-1;
    int i;
    bool br=false;
    for(i=0;i<N;i++){
        if(br)  break;
        if(i+2>=N || (ar[i]!=0 || ar[i+1]!=0 || ar[i+2]!=0){
            Set( i, 0 );
            continue;
        }
        Set( i, 1 );
        ll b1=X & ((ll)1<<curr);
        curr++;
        ll b2=X & ((ll)1<<curr);
        curr++;
        (b1>0)  ?   Set( i+1, 1 )    :   Set( i+1, 0 );
        (b2>0)  ?   Set( i+2, 1 )    :   Set( i+2, 0 );
        i+=2;
        if(curr>62) br=true;
    }
    for(;i<N;i++)   Set( i, 0 );
}
#include <bits/stdc++.h>
#include <Brunolib.h>
typedef long long ll;
using namespace std;
ll Bruno(int N, int A[]){
    ll ans=0, curr=0;
    bool br=false;
    for(int i=0;i<N;i++){
        if(i==1){
            i+=2;
            if(A[i+1]==1)   ans|=((ll)1<<curr);
            curr++;
            if(A[i+2]==1)   ans|=((ll)1<<curr);
            curr++;
            if(curr>62) br=true;
        }
        if(br)  break;
    }
    return ans;
}

Compilation message

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:13:60: error: expected ';' before '{' token
   13 |         if(i+2>=N || (ar[i]!=0 || ar[i+1]!=0 || ar[i+2]!=0){
      |                                                            ^
      |                                                            ;
Anna.cpp:13:19: warning: statement has no effect [-Wunused-value]
   13 |         if(i+2>=N || (ar[i]!=0 || ar[i+1]!=0 || ar[i+2]!=0){
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anna.cpp:17:20: error: expected ')' before ';' token
   17 |         Set( i, 1 );
      |                    ^
      |                    )
Anna.cpp:13:11: note: to match this '('
   13 |         if(i+2>=N || (ar[i]!=0 || ar[i+1]!=0 || ar[i+2]!=0){
      |           ^
Anna.cpp:17:12: error: could not convert 'Set(i, 1)' from 'void' to 'bool'
   17 |         Set( i, 1 );
      |         ~~~^~~~~~~~
      |            |
      |            void