Submission #17129

#TimeUsernameProblemLanguageResultExecution timeMemory
17129muratParrots (IOI11_parrots)C++98
98 / 100
12 ms2432 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; void encode(int N, int M[]) { int c = 0, t; vector< int > v[5]; int P[500] = {0}; int cc[2][500] = {0}; memset(P, 0, sizeof P); memset(cc, 0, sizeof cc); c = 0; for(int i=0; i<N; i++) { int tt = M[i]; for(int j = 0; j < 8; j+=2) { P[c] = (tt >> (6-j)) & 3; cc[1][3-P[c]]++; cc[0][P[c]]++; c++; } } int t1 = cc[0][1] + cc[0][1] * 2 + cc[0][3] * 3; int t2 = cc[1][1] + cc[1][2] * 2 + cc[1][3] * 3; int w = 0; if(t2 < t1) w = 1; send(w); send(w); send(w); send(w); for(int i = 0; i < c; i++) { if(w) P[i] = 3 - P[i]; while(P[i]--) { send(i); } } }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { int cc[500] = {0}, t = 0; memset(cc, 0, sizeof cc); t = 0; for(int i=0; i<L; i++) cc[X[i]]++; int w = 0; if(cc[0] > 3) { cc[0] -= 4; w = 0;} if(cc[1] > 3) { cc[1] -= 4; w = 1;} for(int i = 0; i < N * 4; i++) { if(w) cc[i] = 3 - cc[i]; if(i % 4 == 3) { int t = 64 * cc[i-3] + 16 * cc[i-2] + 4 * cc[i-1] + cc[i]; output(t); } } }

Compilation message (stderr)

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:9:16: warning: unused variable 't' [-Wunused-variable]
     int c = 0, t;
                ^

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:9:24: warning: variable 't' set but not used [-Wunused-but-set-variable]
     int cc[500] = {0}, t = 0;
                        ^
#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...