# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
23618 | Hiasat | Parrots (IOI11_parrots) | C++14 | 5 ms | 2096 KiB |
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;
string to_s(int num){
int tmp = num;
string r = "";
if(num == 0)
r = '0';
while(tmp){
r +=(char)((tmp%10) + '0');
tmp /= 10;
}
reverse(r.begin(),r.end());
return r;
}
int toNum(string r){
int num = 0;
for (int i = 0; i < r.size(); ++i){
num *= 10;
num += (r[i]-'0');
}
return num;
}
void encode(int N, int M[])
{
for(int i=0; i<N; i++){
string cur = to_s(M[i]);
string f = to_s(i);
if(f.size() == 1) f = '0' + f;
cur = cur + f;
send(toNum(cur));
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
string to_s1(int num){
int tmp = num;
string r = "";
if(num == 0)
r = '0';
while(tmp){
r +=(char)((tmp%10) + '0');
tmp /= 10;
}
reverse(r.begin(),r.end());
return r;
}
int ans[110];
void decode(int N, int L, int X[])
{
int i, b;
for(i=0; i<L; i++) {
string cur = to_s1(X[i]);
int test = 0;
for (int j = (int)cur.size() - 2 ; j <= (int)cur.size()-1; ++j){
if(j < 0)
continue;
test *= 10;
test += (cur[j]-'0');
}
int num = 0;
for (int j = 0; j < (int)cur.size() - 2 ; ++j){
num *= 10;
num += (cur[j]-'0');
}
ans[test] = num;
}
for (int i = 0; i < N; ++i){
output(ans[i]);
}
}
Compilation message (stderr)
# | 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... |