Submission #1046617

#TimeUsernameProblemLanguageResultExecution timeMemory
1046617inesfiParrots (IOI11_parrots)C++14
52 / 100
1 ms1328 KiB
#include "encoder.h" #include "encoderlib.h" #include<bits/stdc++.h> using namespace std; void encode(int nbmots, int mots[]){ int a,b,c; for (int i=1;i<=nbmots;i++){ a=mots[i-1]/100; b=(mots[i-1]%100)/10; c=mots[i-1]%10; //cerr<<a<<" "<<b<<" "<<c<<endl; while (a>0){ int x=0; x+=100*(min(a,2)); x+=i; a-=2; send(x); //cerr<<x<<endl; } while (b>0){ int x=0; x+=100*(min(b,2)); x+=i+nbmots; b-=2; send(x); //cerr<<x<<endl; } while (c>0){ int x=0; x+=100*(min(c,2)); x+=i+2*nbmots; c-=2; send(x); //cerr<<x<<endl; } } /*int i; for(i=0; i<N; i++) send(M[i]);*/ }
#include "decoder.h" #include "decoderlib.h" #include<bits/stdc++.h> using namespace std; void decode(int nbmots, int nbrecus, int mots[]){ vector<int> rep; rep.clear(); for (int i=0;i<=nbmots;i++){ rep.push_back(0); } int a,b,c; for (int i=0;i<nbrecus;i++){ a=mots[i]/100; b=(mots[i]%100)/10; c=mots[i]%10; //cerr<<a<<" "<<b<<" "<<c<<endl; if (b*10+c<=nbmots){ rep[b*10+c]+=a*100; } else if (b*10+c<=2*nbmots){ rep[(b*10+c-1)%nbmots+1]+=a*10; } else { rep[(b*10+c-1)%nbmots+1]+=a; } } for (int i=1;i<=nbmots;i++){ //cout<<rep[i]<<endl; output(rep[i]); } /*int i, b; for(i=0; i<L; i++) { b = X[i]; output(b); }*/ }
#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...