Submission #883866

#TimeUsernameProblemLanguageResultExecution timeMemory
883866dejandenibParrots (IOI11_parrots)C++17
98 / 100
9 ms1620 KiB
#include <bits/stdc++.h> #include "encoder.h" #include "encoderlib.h" using namespace std; int mapa2[1000]; map<int,int> mapa; int broj = 0; void rec(int posledno, int n, int s,int depth){ if(depth==7) { mapa[s]=broj; mapa2[broj]=s; //cout<<s<<" "<<broj<<endl; broj++; return; } for(int i =posledno;i<n;i++) { rec(i,n,s*10+i,depth+1); } } void encode(int n, int a[]) { broj = 0; rec(0,5,0,0); int start_from = 0; for(int i =0;i<n;i++) { int x = mapa2[a[i]]; while (x>0) { send((x%10)-1+start_from); x/=10; } start_from+=4; } }
#include <bits/stdc++.h> #include "decoder.h" #include "decoderlib.h" using namespace std; int mapa2[1000]; map<int,int> mapa; int broj = 0; void rec(int posledno, int n, int s,int depth){ if(depth==7) { mapa[s]=broj; mapa2[broj]=s; //cout<<s<<" "<<broj<<endl; broj++; return; } for(int i =posledno;i<n;i++) { rec(i,n,s*10+i,depth+1); } } void decode(int n,int howmany2,int a[]){ broj = 0; rec(0,5,0,0); sort(a,a+howmany2); int start_from = 0; int current = 0; for(int j =0;j<n;j++) { start_from=j*4; current = 0; for(int i = 0;i<howmany2;i++) if (a[i]<start_from+4 && a[i]>=start_from) current = (current*10)+a[i]-start_from+1; output(mapa[current]); } }
#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...