Submission #131280

#TimeUsernameProblemLanguageResultExecution timeMemory
131280arthurconmyParrots (IOI11_parrots)C++14
92 / 100
37 ms2032 KiB
/* Arthur Conmy / arthurconmy */ #include <iostream> #include <fstream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <map> #include <queue> #include <bitset> #include <random> #include <stack> #include <deque> #include <chrono> #ifndef ARTHUR_LOCAL #include "encoder.h" #include "encoderlib.h" #endif using namespace std; #define REP(i,a,b) \ for(int i=(a); i<=(b); i++) #ifdef ARTHUR_LOCAL #define send(x) cout << x << endl; #endif void encode(int N, int M[]) { map<vector<int>,int> MAP; int cur=0; vector<vector<int>> all; REP(a,1,4) { REP(b,a,4) { REP(c,b,4) { REP(d,c,4) { REP(e,d,4) { REP(f,e,4) { REP(g,f,4) { REP(h,g,4) { REP(i,h,4) { REP(j,i,4) { MAP[{a,b,c,d,e,f,g,h,i,j}]=cur++; all.push_back({a,b,c,d,e,f,g,h,i,j}); } } } } } } } } } } REP(i,0,N-1) { // encode M[i] int sending = 4*i; vector<int> V = all[M[i]]; REP(j,0,9) { int now_sending = sending + V[j] - 1; send(now_sending); } } }
/* Arthur Conmy / arthurconmy */ #include <iostream> #include <fstream> #include <vector> #include <string> #include <cmath> #include <algorithm> #include <map> #include <queue> #include <bitset> #include <random> #include <stack> #include <deque> #include <chrono> #ifndef ARTHUR_LOCAL #include "decoder.h" #include "decoderlib.h" #endif using namespace std; #define REP(i,a,b) \ for(int i=(a); i<=(b); i++) #ifdef ARTHUR_LOCAL #define output(x) cout << x << endl; #endif void decode(int N, int L, int X[]) { map<vector<int>,int> M; int cur=0; vector<vector<int>> all; REP(a,1,4) { REP(b,a,4) { REP(c,b,4) { REP(d,c,4) { REP(e,d,4) { REP(f,e,4) { REP(g,f,4) { REP(h,g,4) { REP(i,h,4) { REP(j,i,4) { M[{a,b,c,d,e,f,g,h,i,j}]=cur++; all.push_back({a,b,c,d,e,f,g,h,i,j}); } } } } } } } } } } vector<int> received; REP(i,0,L-1) received.push_back(X[i]); sort(received.begin(),received.end()); REP(i,0,N-1) { cur=0; vector<int> V; REP(j,0,9) { int rem = received[10*i + j]%4; if(rem==0) V.push_back(1); if(rem==1) V.push_back(2); if(rem==2) V.push_back(3); if(rem==3) V.push_back(4); } output(M[V]); } } // int Y[30]; // int main() // { // REP(i,0,2) Y[i]=1; // REP(i,3,9) Y[i]=3; // REP(i,10,19) Y[i]=4; // Y[20]=8; // REP(i,21,27) Y[i]=9; // Y[28]=11; // Y[29]=11; // decode(3,30,Y); // } /*1 1 1 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 8 9 9 9 9 9 9 9 11 11*/
#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...