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;
vector<int> need={
0,
1,
2,
3,
4,
5,
6,
7,
10,
11,
12,
13,
14,
15,
16,
20,
21,
22,
23,
24,
25,
30,
31,
32,
33,
34,
40,
41,
42,
43,
50,
51,
52,
60,
61,
70,
100,
101,
102,
103,
104,
105,
106,
110,
111,
112,
113,
114,
115,
120,
121,
122,
123,
124,
130,
131,
132,
133,
140,
141,
142,
150,
151,
160,
200,
201,
202,
203,
204,
205,
210,
211,
212,
213,
214,
220,
221,
222,
223,
230,
231,
232,
240,
241,
250,
300,
301,
302,
303,
304,
310,
311,
312,
313,
320,
321,
322,
330,
331,
340,
400,
401,
402,
403,
410,
411,
412,
420,
421,
430,
500,
501,
502,
510,
511,
520,
600,
601,
610,
700,
1000,
1001,
1002,
1003,
1004,
1005,
1006,
1010,
1011,
1012,
1013,
1014,
1015,
1020,
1021,
1022,
1023,
1024,
1030,
1031,
1032,
1033,
1040,
1041,
1042,
1050,
1051,
1060,
1100,
1101,
1102,
1103,
1104,
1105,
1110,
1111,
1112,
1113,
1114,
1120,
1121,
1122,
1123,
1130,
1131,
1132,
1140,
1141,
1150,
1200,
1201,
1202,
1203,
1204,
1210,
1211,
1212,
1213,
1220,
1221,
1222,
1230,
1231,
1240,
1300,
1301,
1302,
1303,
1310,
1311,
1312,
1320,
1321,
1330,
1400,
1401,
1402,
1410,
1411,
1420,
1500,
1501,
1510,
1600,
2000,
2001,
2002,
2003,
2004,
2005,
2010,
2011,
2012,
2013,
2014,
2020,
2021,
2022,
2023,
2030,
2031,
2032,
2040,
2041,
2050,
2100,
2101,
2102,
2103,
2104,
2110,
2111,
2112,
2113,
2120,
2121,
2122,
2130,
2131,
2140,
2200,
2201,
2202,
2203,
2210,
2211,
2212,
2220,
2221,
2230,
2300,
2301,
2302,
2310,
2311,
2320
};
void encode(int n, int m[])
{
int dig=0;
for(int i=0;i<n;i++){
int x=need[m[i]];
for(int j=0;j<4;j++){
dig+=x%10;
send(dig);
x/=10;
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> need2={0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,20,21,22,23,24,25,30,31,32,33,34,40,41,42,43,50,51,52,60,61,70,100,101,102,103,104,105,106,110,111,112,113,114,115,120,121,122,123,124,130,131,132,133,140,141,142,150,151,160,200,201,202,203,204,205,210,211,212,213,214,220,221,222,223,230,231,232,240,241,250,300,301,302,303,304,310,311,312,313,320,321,322,330,331,340,400,401,402,403,410,411,412,420,421,430,500,501,502,510,511,520,600,601,610,700,1000,1001,1002,1003,1004,1005,1006,1010,1011,1012,1013,1014,1015,1020,1021,1022,1023,1024,1030,1031,1032,1033,1040,1041,1042,1050,1051,1060,1100,1101,1102,1103,1104,1105,1110,1111,1112,1113,1114,1120,1121,1122,1123,1130,1131,1132,1140,1141,1150,1200,1201,1202,1203,1204,1210,1211,1212,1213,1220,1221,1222,1230,1231,1240,1300,1301,1302,1303,1310,1311,1312,1320,1321,1330,1400,1401,1402,1410,1411,1420,1500,1501,1510,1600,2000,2001,2002,2003,2004,2005,2010,2011,2012,2013,2014,2020,2021,2022,2023,2030,2031,2032,2040,2041,2050,2100,2101,2102,2103,2104,2110,2111,2112,2113,2120,2121,2122,2130,2131,2140,2200,2201,2202,2203,2210,2211,2212,2220,2221,2230,2300,2301,2302,2310,2311,2320};
void decode(int n, int l, int dig[])
{
sort(dig,dig+l);
for(int i=0;i<l;i+=4){
int res=0;
int tem=1;
for(int j=i;j<i+4;j++){
if(j==0){
res+=(dig[j]*tem);
}else{
res += (dig[j]-dig[j-1])*tem;
}
tem*=10;
}
res=lower_bound(need2.begin(), need2.end(), res) - need2.begin();
output(res);
}
}
# | 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... |