제출 #29082

#제출 시각아이디문제언어결과실행 시간메모리
29082NikeforParrots (IOI11_parrots)C++98
17 / 100
6 ms1656 KiB
#include "encoder.h" #include "encoderlib.h" #include<cmath> #include<cstdio> void encode(int N, int M[]) { bool bit = true; for(int i=0; i<8; i++) if(M[i]!=0 and M[i]!=1) bit= false; if(N==8 and bit) { int msg = 0; for(int i=0; i<N; i++) { msg+= M[i]*pow(2, i); // printf("%d eklendi\n", (int)pow(2,i)*M[i]); } // printf("%d\n", msg); send(msg); send(msg); } /*int i; for(i=0; i<N; i++) send(M[i]);*/ }
#include "decoder.h" #include "decoderlib.h" #include<cmath> #include<cstdio> void decode(int N, int L, int X[]) { //int i, b; if(N==8 and X[0]==X[1] ) { bool a[9]; // printf("%d geldi\n", X[0]); for(int i=0; i<9; i++) a[i] = false; int msg = X[0]; for(int i= 7; i>-1; i--) { if(msg>=pow(2,i)) { a[i] = true; // printf("%d varmis\n", (int)pow(2,i)); msg-=pow(2,i); } } for(int i=0 ;i<8; i++) a[i]?output(1):output(0); } /* for(i=0; i<L; i++) { b = X[i]; output(b); }*/ }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...