#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
vector<int> v[1005],g[1005];
int dist[1005];
void send(int x){
REP(i,10){
encode_bit((x>>(9-i))&1);
}
}
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
REP(i,ne){
v[v1[i]].pb(v2[i]);
v[v2[i]].pb(v1[i]);
}
vector<pii> eds;
REP(i,nh){
REP(j,nv) dist[j]=1e9;
dist[i]=0;
queue<int> q;
q.push(i);
while(sz(q)){
int z=q.front();
q.pop();
for(int x:v[z]){
if(dist[x]>dist[z]+1){
g[z].pb(x);
dist[x]=dist[z]+1;
q.push(x);
}
}
}
}
REP(i,nv){
SORT_UNIQUE(g[i]);
send(sz(g[i]));
for(int x:g[i]) send(x);
}
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<ll,int>
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
namespace {
int get(){
int x=0;
REP(i,10){
x=x*2+decode_bit();
}
return x;
}
vector<int> v[1005];
int dist[1005];
}
void decode(int nv, int nh) {
REP(i,nv){
int a=get();
REP(j,a) v[i].pb(get());
}
REP(i,nh){
REP(j,nv) dist[j]=1e9;
dist[i]=0;
queue<int> q;
q.push(i);
while(sz(q)){
int z=q.front();
q.pop();
for(int x:v[z]){
if(dist[x]>dist[z]+1){
dist[x]=dist[z]+1;
q.push(x);
}
}
}
REP(j,nv) hops(i,j,dist[j]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
11672 KB |
Output is partially correct - 190450 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
23 ms |
5740 KB |
Output is partially correct - 75740 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4600 KB |
Output is correct - 230 call(s) of encode_bit() |
5 |
Correct |
36 ms |
6356 KB |
Output is partially correct - 149870 call(s) of encode_bit() |
6 |
Correct |
49 ms |
6540 KB |
Output is partially correct - 159830 call(s) of encode_bit() |
7 |
Correct |
65 ms |
7316 KB |
Output is partially correct - 232660 call(s) of encode_bit() |
8 |
Correct |
17 ms |
5408 KB |
Output is correct - 38850 call(s) of encode_bit() |
9 |
Correct |
19 ms |
5552 KB |
Output is correct - 38720 call(s) of encode_bit() |
10 |
Correct |
19 ms |
5504 KB |
Output is correct - 37890 call(s) of encode_bit() |
11 |
Correct |
25 ms |
5884 KB |
Output is correct - 66510 call(s) of encode_bit() |
12 |
Correct |
16 ms |
5372 KB |
Output is correct - 29610 call(s) of encode_bit() |
13 |
Correct |
69 ms |
6752 KB |
Output is partially correct - 143740 call(s) of encode_bit() |
14 |
Correct |
20 ms |
5500 KB |
Output is correct - 44230 call(s) of encode_bit() |
15 |
Correct |
22 ms |
5504 KB |
Output is correct - 44400 call(s) of encode_bit() |
16 |
Correct |
43 ms |
6284 KB |
Output is partially correct - 72880 call(s) of encode_bit() |
17 |
Correct |
40 ms |
6268 KB |
Output is correct - 68410 call(s) of encode_bit() |
18 |
Correct |
62 ms |
6772 KB |
Output is partially correct - 101340 call(s) of encode_bit() |
19 |
Correct |
41 ms |
6244 KB |
Output is partially correct - 111900 call(s) of encode_bit() |
20 |
Correct |
73 ms |
7128 KB |
Output is partially correct - 122880 call(s) of encode_bit() |
21 |
Correct |
75 ms |
7280 KB |
Output is partially correct - 130200 call(s) of encode_bit() |
22 |
Correct |
77 ms |
7352 KB |
Output is partially correct - 205700 call(s) of encode_bit() |
23 |
Correct |
129 ms |
7792 KB |
Output is partially correct - 176900 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
11672 KB |
Output is partially correct - 190450 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
23 ms |
5740 KB |
Output is partially correct - 75740 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4600 KB |
Output is correct - 230 call(s) of encode_bit() |
5 |
Correct |
36 ms |
6356 KB |
Output is partially correct - 149870 call(s) of encode_bit() |
6 |
Correct |
49 ms |
6540 KB |
Output is partially correct - 159830 call(s) of encode_bit() |
7 |
Correct |
65 ms |
7316 KB |
Output is partially correct - 232660 call(s) of encode_bit() |
8 |
Correct |
17 ms |
5408 KB |
Output is correct - 38850 call(s) of encode_bit() |
9 |
Correct |
19 ms |
5552 KB |
Output is correct - 38720 call(s) of encode_bit() |
10 |
Correct |
19 ms |
5504 KB |
Output is correct - 37890 call(s) of encode_bit() |
11 |
Correct |
25 ms |
5884 KB |
Output is correct - 66510 call(s) of encode_bit() |
12 |
Correct |
16 ms |
5372 KB |
Output is correct - 29610 call(s) of encode_bit() |
13 |
Correct |
69 ms |
6752 KB |
Output is partially correct - 143740 call(s) of encode_bit() |
14 |
Correct |
20 ms |
5500 KB |
Output is correct - 44230 call(s) of encode_bit() |
15 |
Correct |
22 ms |
5504 KB |
Output is correct - 44400 call(s) of encode_bit() |
16 |
Correct |
43 ms |
6284 KB |
Output is partially correct - 72880 call(s) of encode_bit() |
17 |
Correct |
40 ms |
6268 KB |
Output is correct - 68410 call(s) of encode_bit() |
18 |
Correct |
62 ms |
6772 KB |
Output is partially correct - 101340 call(s) of encode_bit() |
19 |
Correct |
41 ms |
6244 KB |
Output is partially correct - 111900 call(s) of encode_bit() |
20 |
Correct |
73 ms |
7128 KB |
Output is partially correct - 122880 call(s) of encode_bit() |
21 |
Correct |
75 ms |
7280 KB |
Output is partially correct - 130200 call(s) of encode_bit() |
22 |
Correct |
77 ms |
7352 KB |
Output is partially correct - 205700 call(s) of encode_bit() |
23 |
Correct |
129 ms |
7792 KB |
Output is partially correct - 176900 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
11672 KB |
Output is partially correct - 190450 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
23 ms |
5740 KB |
Output is partially correct - 75740 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4600 KB |
Output is correct - 230 call(s) of encode_bit() |
5 |
Correct |
36 ms |
6356 KB |
Output is partially correct - 149870 call(s) of encode_bit() |
6 |
Correct |
49 ms |
6540 KB |
Output is partially correct - 159830 call(s) of encode_bit() |
7 |
Correct |
65 ms |
7316 KB |
Output is partially correct - 232660 call(s) of encode_bit() |
8 |
Correct |
17 ms |
5408 KB |
Output is correct - 38850 call(s) of encode_bit() |
9 |
Correct |
19 ms |
5552 KB |
Output is correct - 38720 call(s) of encode_bit() |
10 |
Correct |
19 ms |
5504 KB |
Output is correct - 37890 call(s) of encode_bit() |
11 |
Correct |
25 ms |
5884 KB |
Output is correct - 66510 call(s) of encode_bit() |
12 |
Correct |
16 ms |
5372 KB |
Output is correct - 29610 call(s) of encode_bit() |
13 |
Correct |
69 ms |
6752 KB |
Output is partially correct - 143740 call(s) of encode_bit() |
14 |
Correct |
20 ms |
5500 KB |
Output is correct - 44230 call(s) of encode_bit() |
15 |
Correct |
22 ms |
5504 KB |
Output is correct - 44400 call(s) of encode_bit() |
16 |
Correct |
43 ms |
6284 KB |
Output is partially correct - 72880 call(s) of encode_bit() |
17 |
Correct |
40 ms |
6268 KB |
Output is correct - 68410 call(s) of encode_bit() |
18 |
Correct |
62 ms |
6772 KB |
Output is partially correct - 101340 call(s) of encode_bit() |
19 |
Correct |
41 ms |
6244 KB |
Output is partially correct - 111900 call(s) of encode_bit() |
20 |
Correct |
73 ms |
7128 KB |
Output is partially correct - 122880 call(s) of encode_bit() |
21 |
Correct |
75 ms |
7280 KB |
Output is partially correct - 130200 call(s) of encode_bit() |
22 |
Correct |
77 ms |
7352 KB |
Output is partially correct - 205700 call(s) of encode_bit() |
23 |
Correct |
129 ms |
7792 KB |
Output is partially correct - 176900 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
11672 KB |
Output is partially correct - 190450 call(s) of encode_bit() |
2 |
Correct |
2 ms |
4604 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
23 ms |
5740 KB |
Output is partially correct - 75740 call(s) of encode_bit() |
4 |
Correct |
1 ms |
4600 KB |
Output is correct - 230 call(s) of encode_bit() |
5 |
Correct |
36 ms |
6356 KB |
Output is partially correct - 149870 call(s) of encode_bit() |
6 |
Correct |
49 ms |
6540 KB |
Output is partially correct - 159830 call(s) of encode_bit() |
7 |
Correct |
65 ms |
7316 KB |
Output is partially correct - 232660 call(s) of encode_bit() |
8 |
Correct |
17 ms |
5408 KB |
Output is correct - 38850 call(s) of encode_bit() |
9 |
Correct |
19 ms |
5552 KB |
Output is correct - 38720 call(s) of encode_bit() |
10 |
Correct |
19 ms |
5504 KB |
Output is correct - 37890 call(s) of encode_bit() |
11 |
Correct |
25 ms |
5884 KB |
Output is correct - 66510 call(s) of encode_bit() |
12 |
Correct |
16 ms |
5372 KB |
Output is correct - 29610 call(s) of encode_bit() |
13 |
Correct |
69 ms |
6752 KB |
Output is partially correct - 143740 call(s) of encode_bit() |
14 |
Correct |
20 ms |
5500 KB |
Output is correct - 44230 call(s) of encode_bit() |
15 |
Correct |
22 ms |
5504 KB |
Output is correct - 44400 call(s) of encode_bit() |
16 |
Correct |
43 ms |
6284 KB |
Output is partially correct - 72880 call(s) of encode_bit() |
17 |
Correct |
40 ms |
6268 KB |
Output is correct - 68410 call(s) of encode_bit() |
18 |
Correct |
62 ms |
6772 KB |
Output is partially correct - 101340 call(s) of encode_bit() |
19 |
Correct |
41 ms |
6244 KB |
Output is partially correct - 111900 call(s) of encode_bit() |
20 |
Correct |
73 ms |
7128 KB |
Output is partially correct - 122880 call(s) of encode_bit() |
21 |
Correct |
75 ms |
7280 KB |
Output is partially correct - 130200 call(s) of encode_bit() |
22 |
Correct |
77 ms |
7352 KB |
Output is partially correct - 205700 call(s) of encode_bit() |
23 |
Correct |
129 ms |
7792 KB |
Output is partially correct - 176900 call(s) of encode_bit() |