Submission #935202

#TimeUsernameProblemLanguageResultExecution timeMemory
935202KebabuVaikis15Parrots (IOI11_parrots)C++14
0 / 100
7 ms2468 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; static map<int, bool> lank; static map<int, pair<int, int>> perm; static int b[7]; static int iSkaiciu() { int s=0; for (int i=0; i<7; i++) s+=b[i]<<(2*i); return s; } static void pildyti(int L) { int val=iSkaiciu(); if (lank.count(val)) return; lank[val]=1; perm[perm.size()]={L, val}; for (int i=0; i<L; i++) if ((i==L-1 && b[i]<3) || (i<L-1 && b[i]<b[i+1])) { b[i]++; pildyti(L); b[i]--; } } void encode(int N, int M[]) { for (int i=0; i<=7; i++) { pildyti(i); lank.clear(); } for (int i=0; i<N; i++) for (int j=0; j<perm[M[i]].first; j++) { send((i<<2)+((perm[M[i]].second>>(2*j))&3)); // cout<<((i<<2)+((perm[M[i]].second>>(2*j))&3))<<endl; } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; static map<int, bool> lank2; static map<pair<int, int>, int> perm2; static int b[7]; static int iSkaiciu() { int s=0; for (int i=0; i<7; i++) s+=b[i]<<(2*i); return s; } static void pildyti(int L) { int val=iSkaiciu(); if (lank2.count(val)) return; lank2[val]=1; perm2[{L, val}]=perm2.size(); for (int i=0; i<L; i++) if ((i==L-1 && b[i]<3) || (i<L-1 && b[i]<b[i+1])) { b[i]++; pildyti(L); b[i]--; } } void decode(int N, int L, int X[]) { vector<int> B[N]; for (int i=0; i<=7; i++) { pildyti(i); lank2.clear(); } for (int i=0; i<L; i++) B[X[i]>>2].push_back(X[i]&3); for (int i=0; i<N; i++) { sort(B[i].begin(), B[i].end()); int s=0; for (int j=0; j<B[i].size(); j++) s+=B[i][j]<<(2*j); output(perm2[{B[i].size(), s}]); } }

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:48:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         for (int j=0; j<B[i].size(); j++)
      |                       ~^~~~~~~~~~~~
#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...