Submission #233473

#TimeUsernameProblemLanguageResultExecution timeMemory
233473crossing0verParrots (IOI11_parrots)C++17
96 / 100
22 ms1792 KiB
#include<bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" using namespace std; void encode(int N, int M[]) { int i,val; vector<int> S(256); for(i=0; i<N; i++) { send(M[i]); send(M[i]); send(M[i]); send(M[i]); int t = S[M[i]]; val = i*4; for (int j = 0; j < N; j++) if (M[j] < M[i]) t++; S[M[i]]++; if (t >= 32) send(val + 3),t-=32; while (t >= 8) send(val + 2), t-=8; while (t >= 2) send(val + 1), t-=2; if (t) send(val); } }
#include<bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; void decode(int N, int L, int X[]) { int i, b , pos; vector<int> v(10); vector<int> set; vector<int> S(256); vector<int> ans(N); for(i=0; i<L; i++) { b = X[i]; S[b]++; } for (int i = 0; i < 256; i++) { if (S[i] >= 4) { for (int j = 0; j < S[i]/4; j++) set.push_back(i); S[i] %= 4; } while (S[i]) { S[i]--; int pos = i/4; if (i%4 == 0) { ans[pos] += (1); } else if (i % 4 == 1) ans[pos]+=2; else if (i%4 == 2) ans[pos] += 8; else if (i%4 == 3) ans[pos] += 32; } } sort(set.begin(),set.end()); for (int i = 0; i < N; i++) output(set[ans[i]]); }

Compilation message (stderr)

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:7:14: warning: unused variable 'pos' [-Wunused-variable]
   int i, b , pos;
              ^~~
#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...