#include "grader.h"
#include "encoder.h"
void qu(int x)
{
for (int i=0;i<=11;i++)
{
if ((1<<i)&x)
encode_bit(1);
else
encode_bit(0);
}
}
void encode(int N,int H,int P,int v1[1234567],int v2[1234567])
{
for (int i=0;i<P;i++)
{
int a=v1[i],b=v2[i];
qu(a);qu(b);
}
for (int i=0;i<=11;i++)
encode_bit(1);
}
#include <map>
#include <vector>
#include <set>
#include <cmath>
#include "grader.h"
#include "decoder.h"
using namespace std;
int const MAXN=1000+10;
vector<int>nei[MAXN]={};
int dis[MAXN]={};
void bfs(int x)
{
dis[x]=0;
set<pair<int,int>>s;
s.insert({0,x});
while (s.size())
{
int z=(*begin(s)).second;
s.erase(*begin(s));
for (auto i:nei[z])
{
if (dis[i]>dis[z]+1)
{
s.erase({dis[i],i});
dis[i]=dis[z]+1;
s.insert({dis[i],i});
}
}
}
}
int q()
{
int ans=0;
for (int i=0;i<=11;i++)
{
if (decode_bit())
ans+=(1<<i);
}
return ans;
}
void decode(int N,int H)
{
while (1)
{
int an=q();
if (an==4095)
break;
int o=q();
nei[an].push_back(o);
nei[o].push_back(an);
}
for (int i=0;i<H;i++)
{
for (int j=0;j<N;j++)
dis[j]=1e4;
bfs(i);
for (int j=0;j<N;j++)
hops(i,j,dis[j]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1058 ms |
63628 KB |
Output is partially correct - 6030852 call(s) of encode_bit() |
2 |
Correct |
2 ms |
12036 KB |
Output is correct - 180 call(s) of encode_bit() |
3 |
Correct |
24 ms |
12060 KB |
Output is partially correct - 83628 call(s) of encode_bit() |
4 |
Correct |
2 ms |
12036 KB |
Output is correct - 228 call(s) of encode_bit() |
5 |
Correct |
61 ms |
12308 KB |
Output is partially correct - 236988 call(s) of encode_bit() |
6 |
Correct |
54 ms |
12436 KB |
Output is partially correct - 237324 call(s) of encode_bit() |
7 |
Correct |
123 ms |
16896 KB |
Output is partially correct - 698196 call(s) of encode_bit() |
8 |
Correct |
19 ms |
12012 KB |
Output is correct - 44652 call(s) of encode_bit() |
9 |
Correct |
25 ms |
12280 KB |
Output is partially correct - 80700 call(s) of encode_bit() |
10 |
Correct |
25 ms |
12248 KB |
Output is partially correct - 81684 call(s) of encode_bit() |
11 |
Correct |
61 ms |
12612 KB |
Output is partially correct - 260244 call(s) of encode_bit() |
12 |
Correct |
16 ms |
12264 KB |
Output is correct - 23988 call(s) of encode_bit() |
13 |
Correct |
163 ms |
18696 KB |
Output is partially correct - 900660 call(s) of encode_bit() |
14 |
Correct |
28 ms |
12168 KB |
Output is partially correct - 98724 call(s) of encode_bit() |
15 |
Correct |
36 ms |
12160 KB |
Output is partially correct - 152364 call(s) of encode_bit() |
16 |
Correct |
165 ms |
16700 KB |
Output is partially correct - 823236 call(s) of encode_bit() |
17 |
Correct |
142 ms |
16812 KB |
Output is partially correct - 681564 call(s) of encode_bit() |
18 |
Correct |
196 ms |
18940 KB |
Output is partially correct - 927996 call(s) of encode_bit() |
19 |
Correct |
91 ms |
16792 KB |
Output is partially correct - 464076 call(s) of encode_bit() |
20 |
Correct |
217 ms |
21512 KB |
Output is partially correct - 1213020 call(s) of encode_bit() |
21 |
Correct |
244 ms |
23592 KB |
Output is partially correct - 1475436 call(s) of encode_bit() |
22 |
Correct |
140 ms |
16776 KB |
Output is partially correct - 828444 call(s) of encode_bit() |
23 |
Correct |
270 ms |
25712 KB |
Output is partially correct - 1587972 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1058 ms |
63628 KB |
Output is partially correct - 6030852 call(s) of encode_bit() |
2 |
Correct |
2 ms |
12036 KB |
Output is correct - 180 call(s) of encode_bit() |
3 |
Correct |
24 ms |
12060 KB |
Output is partially correct - 83628 call(s) of encode_bit() |
4 |
Correct |
2 ms |
12036 KB |
Output is correct - 228 call(s) of encode_bit() |
5 |
Correct |
61 ms |
12308 KB |
Output is partially correct - 236988 call(s) of encode_bit() |
6 |
Correct |
54 ms |
12436 KB |
Output is partially correct - 237324 call(s) of encode_bit() |
7 |
Correct |
123 ms |
16896 KB |
Output is partially correct - 698196 call(s) of encode_bit() |
8 |
Correct |
19 ms |
12012 KB |
Output is correct - 44652 call(s) of encode_bit() |
9 |
Correct |
25 ms |
12280 KB |
Output is partially correct - 80700 call(s) of encode_bit() |
10 |
Correct |
25 ms |
12248 KB |
Output is partially correct - 81684 call(s) of encode_bit() |
11 |
Correct |
61 ms |
12612 KB |
Output is partially correct - 260244 call(s) of encode_bit() |
12 |
Correct |
16 ms |
12264 KB |
Output is correct - 23988 call(s) of encode_bit() |
13 |
Correct |
163 ms |
18696 KB |
Output is partially correct - 900660 call(s) of encode_bit() |
14 |
Correct |
28 ms |
12168 KB |
Output is partially correct - 98724 call(s) of encode_bit() |
15 |
Correct |
36 ms |
12160 KB |
Output is partially correct - 152364 call(s) of encode_bit() |
16 |
Correct |
165 ms |
16700 KB |
Output is partially correct - 823236 call(s) of encode_bit() |
17 |
Correct |
142 ms |
16812 KB |
Output is partially correct - 681564 call(s) of encode_bit() |
18 |
Correct |
196 ms |
18940 KB |
Output is partially correct - 927996 call(s) of encode_bit() |
19 |
Correct |
91 ms |
16792 KB |
Output is partially correct - 464076 call(s) of encode_bit() |
20 |
Correct |
217 ms |
21512 KB |
Output is partially correct - 1213020 call(s) of encode_bit() |
21 |
Correct |
244 ms |
23592 KB |
Output is partially correct - 1475436 call(s) of encode_bit() |
22 |
Correct |
140 ms |
16776 KB |
Output is partially correct - 828444 call(s) of encode_bit() |
23 |
Correct |
270 ms |
25712 KB |
Output is partially correct - 1587972 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1058 ms |
63628 KB |
Output is partially correct - 6030852 call(s) of encode_bit() |
2 |
Correct |
2 ms |
12036 KB |
Output is correct - 180 call(s) of encode_bit() |
3 |
Correct |
24 ms |
12060 KB |
Output is partially correct - 83628 call(s) of encode_bit() |
4 |
Correct |
2 ms |
12036 KB |
Output is correct - 228 call(s) of encode_bit() |
5 |
Correct |
61 ms |
12308 KB |
Output is partially correct - 236988 call(s) of encode_bit() |
6 |
Correct |
54 ms |
12436 KB |
Output is partially correct - 237324 call(s) of encode_bit() |
7 |
Correct |
123 ms |
16896 KB |
Output is partially correct - 698196 call(s) of encode_bit() |
8 |
Correct |
19 ms |
12012 KB |
Output is correct - 44652 call(s) of encode_bit() |
9 |
Correct |
25 ms |
12280 KB |
Output is partially correct - 80700 call(s) of encode_bit() |
10 |
Correct |
25 ms |
12248 KB |
Output is partially correct - 81684 call(s) of encode_bit() |
11 |
Correct |
61 ms |
12612 KB |
Output is partially correct - 260244 call(s) of encode_bit() |
12 |
Correct |
16 ms |
12264 KB |
Output is correct - 23988 call(s) of encode_bit() |
13 |
Correct |
163 ms |
18696 KB |
Output is partially correct - 900660 call(s) of encode_bit() |
14 |
Correct |
28 ms |
12168 KB |
Output is partially correct - 98724 call(s) of encode_bit() |
15 |
Correct |
36 ms |
12160 KB |
Output is partially correct - 152364 call(s) of encode_bit() |
16 |
Correct |
165 ms |
16700 KB |
Output is partially correct - 823236 call(s) of encode_bit() |
17 |
Correct |
142 ms |
16812 KB |
Output is partially correct - 681564 call(s) of encode_bit() |
18 |
Correct |
196 ms |
18940 KB |
Output is partially correct - 927996 call(s) of encode_bit() |
19 |
Correct |
91 ms |
16792 KB |
Output is partially correct - 464076 call(s) of encode_bit() |
20 |
Correct |
217 ms |
21512 KB |
Output is partially correct - 1213020 call(s) of encode_bit() |
21 |
Correct |
244 ms |
23592 KB |
Output is partially correct - 1475436 call(s) of encode_bit() |
22 |
Correct |
140 ms |
16776 KB |
Output is partially correct - 828444 call(s) of encode_bit() |
23 |
Correct |
270 ms |
25712 KB |
Output is partially correct - 1587972 call(s) of encode_bit() |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1058 ms |
63628 KB |
Output is partially correct - 6030852 call(s) of encode_bit() |
2 |
Correct |
2 ms |
12036 KB |
Output is correct - 180 call(s) of encode_bit() |
3 |
Correct |
24 ms |
12060 KB |
Output is partially correct - 83628 call(s) of encode_bit() |
4 |
Correct |
2 ms |
12036 KB |
Output is correct - 228 call(s) of encode_bit() |
5 |
Correct |
61 ms |
12308 KB |
Output is partially correct - 236988 call(s) of encode_bit() |
6 |
Correct |
54 ms |
12436 KB |
Output is partially correct - 237324 call(s) of encode_bit() |
7 |
Correct |
123 ms |
16896 KB |
Output is partially correct - 698196 call(s) of encode_bit() |
8 |
Correct |
19 ms |
12012 KB |
Output is correct - 44652 call(s) of encode_bit() |
9 |
Correct |
25 ms |
12280 KB |
Output is partially correct - 80700 call(s) of encode_bit() |
10 |
Correct |
25 ms |
12248 KB |
Output is partially correct - 81684 call(s) of encode_bit() |
11 |
Correct |
61 ms |
12612 KB |
Output is partially correct - 260244 call(s) of encode_bit() |
12 |
Correct |
16 ms |
12264 KB |
Output is correct - 23988 call(s) of encode_bit() |
13 |
Correct |
163 ms |
18696 KB |
Output is partially correct - 900660 call(s) of encode_bit() |
14 |
Correct |
28 ms |
12168 KB |
Output is partially correct - 98724 call(s) of encode_bit() |
15 |
Correct |
36 ms |
12160 KB |
Output is partially correct - 152364 call(s) of encode_bit() |
16 |
Correct |
165 ms |
16700 KB |
Output is partially correct - 823236 call(s) of encode_bit() |
17 |
Correct |
142 ms |
16812 KB |
Output is partially correct - 681564 call(s) of encode_bit() |
18 |
Correct |
196 ms |
18940 KB |
Output is partially correct - 927996 call(s) of encode_bit() |
19 |
Correct |
91 ms |
16792 KB |
Output is partially correct - 464076 call(s) of encode_bit() |
20 |
Correct |
217 ms |
21512 KB |
Output is partially correct - 1213020 call(s) of encode_bit() |
21 |
Correct |
244 ms |
23592 KB |
Output is partially correct - 1475436 call(s) of encode_bit() |
22 |
Correct |
140 ms |
16776 KB |
Output is partially correct - 828444 call(s) of encode_bit() |
23 |
Correct |
270 ms |
25712 KB |
Output is partially correct - 1587972 call(s) of encode_bit() |