#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
void encode(int nv, int nh, int ne, int *v1, int *v2){
int ans[40][1005];
vector<int> v[1005];
for(int i = 0; i < ne; i++)
{
v[v1[i]].pb(v2[i]);
v[v2[i]].pb(v1[i]);
}
for(int i = 0; i < nh; i++)
{
for(int j = 0; j < 1005; j++)
ans[i][j] = 1e9;
ans[i][i] = 0;
queue<pair<int,int> > pq;
pq.push({-0,i});
while(!pq.empty())
{
int val = -pq.front().f;
int nw = pq.front().s;
pq.pop();
for(auto go: v[nw])
{
if(val + 1 < ans[i][go])
{
ans[i][go] = val + 1;
pq.push({-ans[i][go],go});
}
}
}
}
for(int i = 0; i < nh; i++)
for(int j = 0; j < nv; j++)
{
for(int k = 0; k < 10; k++)
{
if((1<<k) & ans[i][j])
encode_bit(1);
else
encode_bit(0);
}
}
return;
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
void decode(int nv, int nh) {
for(int i = 0; i < nh; i++)
for(int j = 0; j < nv; j++)
{
int val = 0;
for(int k = 0; k < 10; k++)
{
int a = decode_bit();
val += a * (1<<k);
}
hops(i,j,val);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
12548 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4740 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
68 ms |
7444 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
74 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
81 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
102 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
78 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
86 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
7896 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
82 ms |
7684 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
105 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
85 ms |
7856 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
88 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
104 ms |
8136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
142 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
92 ms |
8100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
112 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
119 ms |
8908 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
101 ms |
8352 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
9132 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
12548 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4740 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
68 ms |
7444 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
74 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
81 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
102 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
78 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
86 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
7896 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
82 ms |
7684 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
105 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
85 ms |
7856 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
88 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
104 ms |
8136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
142 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
92 ms |
8100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
112 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
119 ms |
8908 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
101 ms |
8352 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
9132 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
12548 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4740 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
68 ms |
7444 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
74 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
81 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
102 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
78 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
86 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
7896 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
82 ms |
7684 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
105 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
85 ms |
7856 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
88 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
104 ms |
8136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
142 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
92 ms |
8100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
112 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
119 ms |
8908 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
101 ms |
8352 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
9132 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
12548 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4740 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
68 ms |
7444 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4732 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
74 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
81 ms |
7820 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
102 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
78 ms |
7552 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
86 ms |
7724 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
80 ms |
7752 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
88 ms |
7896 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
82 ms |
7684 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
105 ms |
8476 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
85 ms |
7856 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
80 ms |
7788 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
88 ms |
8280 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
104 ms |
8136 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
142 ms |
8472 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
92 ms |
8100 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
112 ms |
8904 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
119 ms |
8908 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
101 ms |
8352 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
113 ms |
9132 KB |
Output is partially correct - 360000 call(s) of encode_bit() |