Submission #963769

#TimeUsernameProblemLanguageResultExecution timeMemory
963769AmrParrots (IOI11_parrots)C++17
0 / 100
1 ms1316 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define sz size() void encode(int N, int M[]) { vector<pair<ll,ll> > v; for(int i = 0; i < N; i++) v.push_back({M[i],i}); sort(v.begin(),v.end()); for(int i = 0; i < N; i++) { send(M[i]); send(M[i]); send(M[i]); send(M[i]); } for(int i = 0; i < N; i++) { //cout << v[i].second << " "; ll j = i/2; if(v[i].second>=16&&i%2) {send(v[i].second%16+j*16); send(v[i].second%16+j*16); //send(v[i].second%16+j*16); send(v[i].second%16+j*16);} else if(v[i].second>=16) {send(v[i].second%16+j*16); //send(v[i].second%16+j*16); send(v[i].second%16+j*16);} else if(i%2) {send(v[i].second%16+j*16); //send(v[i].second%16+j*16);} } } }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define sz size() #define F first #define S second const int M = 256; ll ans[M+2]; ll freq[M+2]; void decode(int N, int L, int X[]) { //for(int i = 0; i < L; i++) cout << X[i] << " "; cout << endl; //return; for(int i = 0; i < M; i++) freq[i] = 0; for(int i = 0; i < L; i++) freq[X[i]]++; vector<pair<ll,ll> > vv; vector<ll> v; for(int i = 0; i < M; i++){ for(int j = 0 ; j < freq[i]/4; j++) v.push_back(i); if(freq[i]%4==0) vv.push_back({2*i,0}); if(freq[i]%4==1) vv.push_back({2*i+1,0}); if(freq[i]%4==2) vv.push_back({2*i,1}); if(freq[i]%4==3) vv.push_back({2*i+1,1}); } sort(vv.begin(),vv.end()); //for(int i = 0; i < vv.sz; i++) cout << vv[i].F << " " << vv[i].S << endl; // cout << v.sz << " " << vv.sz << endl; return; ll l = 0; for(int i = 0; i < N; i++) { //cout << vv[l]%16 << " " << v[i]<< endl; ll l2 = l; if(vv[l].first&1) { if(i%2==0) l2++; } else{ if(i%2==1) l2--; } ll y = vv[l2].second; ll x = vv[l2].F; x/=2; x%=16; //cout << x+y*16 << " "; ans[x+y*16] = v[i]; l++; } for(int i=0; i< N; i++) { output(ans[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...