답안 #954871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954871 2024-03-28T18:28:45 Z leo_2727 Broken Device (JOI17_broken_device) C++17
컴파일 오류
0 ms 0 KB
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 );
}
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:1:19: error: 'll' has not been declared
    1 | void Anna( int N, ll X, int K, int P[] ){
      |                   ^~
Anna.cpp: In function 'void Anna(int, int, int, int*)':
Anna.cpp:3:5: error: 'll' was not declared in this scope
    3 |     ll curr=0;
      |     ^~
Anna.cpp:10:13: error: 'Set' was not declared in this scope
   10 |             Set( i, 0 );
      |             ^~~
Anna.cpp:13:9: error: 'Set' was not declared in this scope
   13 |         Set( i, 1 );
      |         ^~~
Anna.cpp:14:11: error: expected ';' before 'b1'
   14 |         ll b1=X & ((ll)1<<curr);
      |           ^~~
      |           ;
Anna.cpp:15:9: error: 'curr' was not declared in this scope
   15 |         curr++;
      |         ^~~~
Anna.cpp:16:11: error: expected ';' before 'b2'
   16 |         ll b2=X & ((ll)1<<curr);
      |           ^~~
      |           ;
Anna.cpp:18:10: error: 'b1' was not declared in this scope; did you mean 'br'?
   18 |         (b1>0)  ?   Set( i+1, 1 )    :   Set( i+1, 0 );
      |          ^~
      |          br
Anna.cpp:19:10: error: 'b2' was not declared in this scope; did you mean 'br'?
   19 |         (b2>0)  ?   Set( i+2, 1 )    :   Set( i+2, 0 );
      |          ^~
      |          br
Anna.cpp:23:21: error: 'Set' was not declared in this scope
   23 |     for(;i<N;i++)   Set( i, 0 );
      |                     ^~~

Bruno.cpp:1:1: error: 'll' does not name a type
    1 | ll Bruno(int N, int A[]){
      | ^~