Submission #17121

#TimeUsernameProblemLanguageResultExecution timeMemory
17121muratParrots (IOI11_parrots)C++98
17 / 100
12 ms2400 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[500] = {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[P[c]]++; c++; } } int mx = max(max(cc[0], cc[1]), max(cc[2], cc[3])); if(0 || mx == cc[0]) { t = 0; send(0); send(0); send(0); send(0); } else if(mx == cc[1]) { t = 1; send(1); send(1); send(1); send(1); } else if(mx == cc[2]) { t = 2; send(2); send(2); send(2); send(2); } else if(mx == cc[3]) { t = 3; send(3); send(3); send(3); send(3); } for(int i = 0; i < c; i++) { if(P[i] == t) P[i] = 0; if(P[i] < t) 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; for(int i=0; i<L; i++) cc[X[i]]++; if(0 || cc[0] > 3) { cc[0] -= 4; t = 0;} else if(cc[1] > 3) { cc[1] -= 4; t = 1;} else if(cc[2] > 3) { cc[2] -= 4; t = 2;} else if(cc[3] > 3) { cc[3] -= 4; t = 3;} for(int i = 0; i < N * 4; i++) { if(cc[i] == 0) cc[i] = t; else if(cc[i] <= t) 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:32:9: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if(P[i] < t) P[i]++;
         ^~
#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...