Submission #1116541

#TimeUsernameProblemLanguageResultExecution timeMemory
1116541PagodePaivaParrots (IOI11_parrots)C++17
81 / 100
6 ms1468 KiB
#include<bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" using namespace std; void encode(int n, int M[]){ for(int i = 0;i < n;i++){ for(int j = 0;j < 8;j += 2){ int res = i; int d = j/2; res += 32*d; int d1 = (M[i]&(1<<j)), d2 = (M[i]&(1<<(j+1))); if(d1 > 0) d1 = 1; if(d2 > 0) d2 = 1; res += 128*d1; if(d1 == d2){ send(res); } else{ send(res); send(res); } } } return; }
#include<bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; void decode(int n, int L, int X[]){ int res[n]; for(int i = 0;i < n;i++) res[i] = 0; map <int, int> m; for(int i = 0;i < L;i++){ m[X[i]]++; } for(auto [val, tp] : m){ int pos = val%32; int parte = ((val/32)%4)*2; int d = val/128; if(tp == 1){ res[pos] += d*(1<<parte)+d*(1<<(parte+1)); } else{ res[pos] += d*(1<<parte)+(1-d)*(1<<(parte+1)); } } for(int i = 0;i < n;i++){ //cout << res[i] << ' '; output(res[i]); } //cout << '\n'; return; }
#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...