제출 #573192

#제출 시각아이디문제언어결과실행 시간메모리
573192TimDeeParrots (IOI11_parrots)C++14
컴파일 에러
0 ms0 KiB
void encode(int n, int message[]) {
    forn(i,n) {
        int x=message[i];
        int a=x%4;
        send(a+i*64);
        x/=4;
        a=x%4;
        send(a+i*64+4);
        x/=4;
        a=x%4;
        send(a+i*64+8);
        x/=4;
        a=x%4;
        send(a+i*64+12);
    }
}
void decode(int N, int L, int message[]) {
    int a[N];
    forn(i,N) a[i]=0;
    forn(i,L) {
        int x=message[i];
        int j=x/64;
        int k=(x/4)%4;
        int v=x%4;
        //cout<<"["<<j<<"] = "<<v<<' '<<k<<'\n';
        if (k==0) {
            a[j]+=v;
        } else if (k==1) {
            a[j]+=v*4;
        } else if (k==2) {
            a[j]+=v*16;
        } else {
            a[j]+=v*64;
        }
    }
    forn(i,N) output(a[i]);
}

컴파일 시 표준 에러 (stderr) 메시지

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:2:10: error: 'i' was not declared in this scope
    2 |     forn(i,n) {
      |          ^
encoder.cpp:2:5: error: 'forn' was not declared in this scope
    2 |     forn(i,n) {
      |     ^~~~

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:3:10: error: 'i' was not declared in this scope
    3 |     forn(i,N) a[i]=0;
      |          ^
decoder.cpp:3:5: error: 'forn' was not declared in this scope
    3 |     forn(i,N) a[i]=0;
      |     ^~~~
decoder.cpp:2:9: warning: unused variable 'a' [-Wunused-variable]
    2 |     int a[N];
      |         ^