This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |