Submission #29253

#TimeUsernameProblemLanguageResultExecution timeMemory
29253NikeforParrots (IOI11_parrots)C++98
Compilation error
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" #include<cmath> #include<cstdio> bool a[9]; void encode(int N, int M[]) { int sum=0; // printf("hebele\n"); for(int i=0; i<N; i++) { for(int b=0; b<9; b++) a[b] = false; int n = M[i]; for(int j=7; j>-1; j--) { if( n>=(1<<j) ) { a[j] = true; // printf("%d true\n", j); n-=1<<j; } } for(int j=0; j<4; j++) { if(a[2*j] and a[2*j+1]) { sum+=3; } else if(a[2*j]) { sum+=2;} else if(a[2*j+1]) {sum++;} } } for(int i=0; i<N; i++) { for(int b=0; b<9; b++) a[b] = false; int n = M[i]; int msg=i; // printf("%d sayi var i=%d\n",N, i); msg = msg<<2; // printf("msg %d\n", msg); //n sayisi ikilik tabana donusturule for(int j=7; j>-1; j--) { if( n>=(1<<j) ) { a[j] = true; // printf("%d true\n", j); n-=1<<j; } } //printf("hebele\n"); /* if(sum> (6*N)) { printf("hebele\n"); int sen=4; send(255); send(255); send(255); send(255); for(int j=0; j<4; j++) { if(!(a[2*j] or a[2*j+1]) ) { /*printf("%d 3 kere\n", j); */send(msg+j); send(msg+j); send(msg+j); sen+=3;} else if(a[2*j] and a[2*j+1]) continue; else if(a[2*j]) { send(msg+j); send(msg+j); /*printf("%d 2 kere\n", j);*/ sen+=2;} else if(a[2*j+1]) {/*printf("%d 1 kere\n", j); */send(msg+j); sen++;} } // printf("%d kere yollandi\n",sen); }*/ else for(int j=0; j<4; j++) { if(a[2*j] and a[2*j+1]) { /*printf("%d 3 kere\n", j);*/ send(msg+j); send(msg+j); send(msg+j); } else if(a[2*j]) { send(msg+j); /*printf("%d 1 kere\n", j); */} else if(a[2*j+1]) {/*printf("%d 2 kere\n", j); */send(msg+j); send(msg+j); } } } /*int i; for(i=0; i<N; i++) send(M[i]);*/ }
#include "decoder.h" #include "decoderlib.h" #include<cmath> #include<cstdio> #include<bits/stdc++.h> using namespace std; int as[66][6]; int ctr; void decode(int N, int L, int X[]) { for(int i=0; i<66; i++) for(int j=0; j<6;j++) as[i][j] = 0; ctr = 0; for(int i=0; i<L; i++) if(X[i]==255) ctr++; if(ctr>3) { for(int i=0; i<66; i++) for(int j=0; j<6;j++) as[i][j] = 3; for(int i=0; i<L; i++) { int n = X[i]; n = n>>2; int k = X[i]%4; as[n][k]--; // printf("%d . sayinin %d . bit ikilisi\n", n, k); } as[63][3]+=4; } else for(int i=0; i<L; i++) { // if(X[i]==255) ctr++; //63 3 // printf("kod %d\n", X[i]); int n = X[i]; n = n>>2; int k = X[i]%4; as[n][k]++; // printf("%d . sayinin %d . bit ikilisi\n", n, k); } for(int i=0; i<N; i++) { int msg = 0; for(int j=0; j<4; j++) msg+= as[i][j]*1<<(2*j); output(msg); // printf("%d\n", msg); } //int i, b; }

Compilation message (stderr)

encoder.cpp:52:46: warning: "/*" within comment [-Wcomment]
                 if(!(a[2*j] or a[2*j+1]) ) { /*printf("%d 3 kere\n", j); */send(msg+j); send(msg+j); send(msg+j); sen+=3;}
                                               
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:52:85: error: 'j' was not declared in this scope
                 if(!(a[2*j] or a[2*j+1]) ) { /*printf("%d 3 kere\n", j); */send(msg+j); send(msg+j); send(msg+j); sen+=3;}
                                                                                     ^
encoder.cpp:52:115: error: 'sen' was not declared in this scope
                 if(!(a[2*j] or a[2*j+1]) ) { /*printf("%d 3 kere\n", j); */send(msg+j); send(msg+j); send(msg+j); sen+=3;}
                                                                                                                   ^~~
encoder.cpp:52:115: note: suggested alternative: 'send'
                 if(!(a[2*j] or a[2*j+1]) ) { /*printf("%d 3 kere\n", j); */send(msg+j); send(msg+j); send(msg+j); sen+=3;}
                                                                                                                   ^~~
                                                                                                                   send
encoder.cpp:53:17: error: 'else' without a previous 'if'
                 else if(a[2*j] and a[2*j+1]) continue;
                 ^~~~
encoder.cpp:53:29: error: 'j' was not declared in this scope
                 else if(a[2*j] and a[2*j+1]) continue;
                             ^
encoder.cpp:53:46: error: continue statement not within a loop
                 else if(a[2*j] and a[2*j+1]) continue;
                                              ^~~~~~~~
encoder.cpp:54:40: error: 'msg' was not declared in this scope
                 else if(a[2*j]) { send(msg+j); send(msg+j); /*printf("%d 2 kere\n", j);*/ sen+=2;}
                                        ^~~
encoder.cpp:54:91: error: 'sen' was not declared in this scope
                 else if(a[2*j]) { send(msg+j); send(msg+j); /*printf("%d 2 kere\n", j);*/ sen+=2;}
                                                                                           ^~~
encoder.cpp:54:91: note: suggested alternative: 'send'
                 else if(a[2*j]) { send(msg+j); send(msg+j); /*printf("%d 2 kere\n", j);*/ sen+=2;}
                                                                                           ^~~
                                                                                           send
encoder.cpp:55:72: error: 'msg' was not declared in this scope
                 else if(a[2*j+1]) {/*printf("%d 1 kere\n", j);  */send(msg+j); sen++;}
                                                                        ^~~
encoder.cpp:55:80: error: 'sen' was not declared in this scope
                 else if(a[2*j+1]) {/*printf("%d 1 kere\n", j);  */send(msg+j); sen++;}
                                                                                ^~~
encoder.cpp:55:80: note: suggested alternative: 'send'
                 else if(a[2*j+1]) {/*printf("%d 1 kere\n", j);  */send(msg+j); sen++;}
                                                                                ^~~
                                                                                send
encoder.cpp: At global scope:
encoder.cpp:60:9: error: expected declaration before '}' token
         }*/
         ^