Submission #960925

#TimeUsernameProblemLanguageResultExecution timeMemory
960925emptypringlescanParrots (IOI11_parrots)C++17
81 / 100
8 ms1496 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int n, int m[]){ for(int i=0; i<n; i++){ vector<int> stuff; for(int j=6; j>=0; j-=2){ stuff.push_back(((m[i]>>j)&0b11)); send((i*2+(j<4?1:0))*4+((m[i]>>j)&0b11)); } if(stuff[0]<stuff[1]){ send(i*2*4); send(i*2*4); send(i*2*4); } else{ send(i*2*4+1); send(i*2*4+1); send(i*2*4+1); } if(stuff[2]<stuff[3]){ send((i*2+1)*4); send((i*2+1)*4); send((i*2+1)*4); } else{ send((i*2+1)*4+1); send((i*2+1)*4+1); send((i*2+1)*4+1); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int n, int l, int x[]){ map<int,int> got,done; vector<int> ord; for(int i=0; i<l; i++){ got[x[i]]++; if(done[x[i]]==0&&got[x[i]]==3){ ord.push_back(x[i]); got[x[i]]-=3; done[x[i]]=1; } } vector<int> ok; for(auto i:got) if(i.second!=3) for(int j=0; j<i.second; j++) ok.push_back(i.first); int p=ok.size(); //cout << p << ' '; assert(p%2==0); vector<int> yes[100]; for(auto i:ok){ yes[i>>2].push_back(i&0b11); } for(int i:ord){ int y=i>>2; if(i&1) sort(yes[y].begin(),yes[y].end(),greater<int>()); else sort(yes[y].begin(),yes[y].end()); } vector<int> ans; for(int i=0; i<100; i++) for(int j:yes[i]) ans.push_back(j); for(int i=0; i<(int)ans.size(); i+=4){ output(ans[i]<<6|ans[i+1]<<4|ans[i+2]<<2|ans[i+3]); } }
#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...