Submission #29146

#TimeUsernameProblemLanguageResultExecution timeMemory
29146ozaslanParrots (IOI11_parrots)C++14
0 / 100
7 ms2608 KiB
#include<bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; #include "encoder.h" #include "decoder.h" #include "encoderlib.h" #include "decoderlib.h" #include <stdio.h> #include <stdlib.h> void encode(int N, int M[]) { vector< pair<int, int> > V(3); for (int i = 0; i < N; i++) { // printf("%d ", M[i]); int sira = (i << 3); int bir = (M[i] & 7); int iki = (M[i] >> 3) & 7; int uc = (M[i] >> 6) & 7; V[0] = make_pair(bir , 1); send(sira + bir); V[1] = make_pair(iki , 2); send(sira + iki); V[2] = make_pair(uc , 3); send(sira + uc); sort(V.begin(), V.end()); int g = 100*V[0].second + 10*V[1].second + V[2].second; if(g == 123) for (int k=0; k<4; k++) send(sira + 1); if(g == 132) for (int k=0; k<4; k++) send(sira + 2); if(g == 213) for (int k=0; k<4; k++) send(sira + 3); if(g == 231) for (int k=0; k<4; k++) send(sira + 4); if(g == 312) for (int k=0; k<4; k++) send(sira + 5); if(g == 321) for (int k=0; k<4; k++) send(sira + 6); } // printf("\n"); }
#include<bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; #include "encoder.h" #include "decoder.h" #include "encoderlib.h" #include "decoderlib.h" #include <stdio.h> #include <stdlib.h> void decode(int N, int L, int X[]) { vector<int> v(3), x; vector< vector<int> > V; for (int i = 0; i < L; i++) { int siras = (X[i] >> 3) & 31; int bilgi = X[i] & 7; //printf("Sira: %d, bilgi: %d\n", siras, bilgi); V.push_back(x); V[siras].push_back(bilgi); } for (int i = 0; i < N; i++) { sort(V[i].begin(), V[i].end()); int anahtar, k = 1; for (int j = 1; j < 7; j++) { if (V[i][j] == V[i][j-1]) { k++; if (k == 4) anahtar = V[i][j]; } else k = 1; } //printf("\na: %d, sira:%d ", anahtar, i); int s = 0; k = 0; for (int j = 0; j < 7; j++) { if(V[i][j] == anahtar && k < 4) k++; else { v[s] = V[i][j]; s++;} // cout << v[s] << " "; } sort(v.begin(), v.end()); //printf("v0 = %d, v1 = %d, v2 = %d, sonuc: ", v[0], v[1], v[2]); int sonuc; if(anahtar == 1) sonuc = v[0] + (v[1] << 3) + (v[2] << 6); if(anahtar == 2) sonuc = v[0] + (v[2] << 3) + (v[1] << 6); if(anahtar == 3) sonuc = v[1] + (v[0] << 3) + (v[2] << 6); if(anahtar == 4) sonuc = v[2] + (v[0] << 3) + (v[1] << 6); if(anahtar == 5) sonuc = v[1] + (v[2] << 3) + (v[0] << 6); if(anahtar == 6) sonuc = v[2] + (v[1] << 3) + (v[0] << 6); // printf("%d ", sonuc); output(sonuc); } }

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:58:15: warning: 'sonuc' may be used uninitialized in this function [-Wmaybe-uninitialized]
         output(sonuc);
         ~~~~~~^~~~~~~
decoder.cpp:51:9: warning: 'anahtar' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if(anahtar == 1) sonuc = v[0] + (v[1] << 3) + (v[2] << 6);
         ^~
#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...