Submission #1167363

#TimeUsernameProblemLanguageResultExecution timeMemory
1167363trandangquangBroken Device (JOI17_broken_device)C++20
Compilation error
0 ms0 KiB
#include "Annalib.h"

#include<bits/stdc++.h>
using namespace std;

int A[200];
void Set(int pos, int bit);
void hihi(int p, int val){
    for(int i=0; i<3; ++i){
        Set(p+i,val>>i&1);
    }
}
void Anna(int N, long long X, int K, int P[]){
    for(int i=0; i<N; ++i) A[i]=0;
    for(int i=0; i<K; ++i) A[P[i]]=1;
    deque<int> dq;
    for(int i=0; i<60; ++i){
        dq.push_back(X>>i&1);
    }
    for(int i=0; i<60; ++i) dq.push_back(0);

    for(int i=0; i<N; i+=3){
        int t=A[i]+A[i+1]+A[i+2];
        if(t>=2){
            Set(i,0), Set(i+1,0), Set(i+2,0);
        }
        else if(t==1){
            if(A[i]==1){
                if(dq[0]) hihi(i,6);
                else hihi(i,2);
                dq.pop_front();
            }
            else if(A[i+1]==1){
                if(dq[0]){
                    hihi(i,1);
                    dq.pop_front();
                }
                else{
                    if(dq[1]) hihi(i,3);
                    else hihi(i,4);

                    dq.pop_front(); dq.pop_front();
                }
            }
            else{
                if(dq[0]) hihi(i,1);
                else hihi(i,2);
                dq.pop_front();
            }
        }
        else{
            if(!dq[0]&&!dq[1]) hihi(i,4);
            else if(!dq[0]&&dq[1]) hihi(i,3);
            else if(dq[0]&&!dq[1]) hihi(i,5);
            else hihi(i,7);

            dq.pop_front(); dq.pop_front();
        }
    }
}
#include "Annalib.h"

#include<bits/stdc++.h>
using namespace std;

int A[200];
void Set(int pos, int bit);
void hihi(int p, int val){
    for(int i=0; i<3; ++i){
        Set(p+i,val>>i&1);
    }
}
void Anna(int N, long long X, int K, int P[]){
    for(int i=0; i<K; ++i) A[P[i]]=1;
    deque<int> dq;
    for(int i=0; i<60; ++i){
        dq.push_back(X>>i&1);
    }
    for(int i=0; i<60; ++i) dq.push_back(0);

    for(int i=0; i<N; i+=3){
        int t=A[i]+A[i+1]+A[i+2];
        if(t>=2){
            Set(i,0), Set(i+1,0), Set(i+2,0);
        }
        else if(t==1){
            if(A[i]==1){
                if(dq[0]) hihi(i,6);
                else hihi(i,2);
                dq.pop_front();
            }
            else if(A[i+1]==1){
                if(dq[0]){
                    hihi(i,1);
                    dq.pop_front();
                }
                else{
                    if(dq[1]) hihi(i,3);
                    else hihi(i,4);

                    dq.pop_front(); dq.pop_front();
                }
            }
            else{
                if(dq[0]) hihi(i,1);
                else hihi(i,2);
                dq.pop_front();
            }
        }
        else{
            if(!dq[0]&&!dq[1]) hihi(i,4);
            else if(!dq[0]&&dq[1]) hihi(i,3);
            else if(dq[0]&&!dq[1]) hihi(i,5);
            else hihi(i,7);

            dq.pop_front(); dq.pop_front();
        }
    }
}

Compilation message (stderr)

# 2번째 컴파일 단계

/usr/bin/ld: /tmp/ccoBvyKz.o: in function `hihi(int, int)':
Bruno.cpp:(.text+0x20): undefined reference to `Set(int, int)'
/usr/bin/ld: /tmp/ccoBvyKz.o: in function `Anna(int, long long, int, int*)':
Bruno.cpp:(.text+0x287): undefined reference to `Set(int, int)'
/usr/bin/ld: Bruno.cpp:(.text+0x294): undefined reference to `Set(int, int)'
/usr/bin/ld: Bruno.cpp:(.text+0x29e): undefined reference to `Set(int, int)'
/usr/bin/ld: Bruno.cpp:(.text+0x32b): undefined reference to `Set(int, int)'
/usr/bin/ld: /tmp/ccoBvyKz.o:Bruno.cpp:(.text+0x335): more undefined references to `Set(int, int)' follow
/usr/bin/ld: /tmp/cchoGicP.o: in function `main':
grader_bruno.c:(.text.startup+0x13c): undefined reference to `Bruno(int, int*)'
collect2: error: ld returned 1 exit status