#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
void writeSmallInt(int x) {
RE(i,10) {
bool b = false;
if(x & (1<<i)) b = 1;
encode_bit(b);
}
}
void encode(int nv, int nh, int ne, int *v1, int *v2) {
vector<vi> adj; adj.resize(nv);
RE(i,ne) {
adj[v1[i]].pb(v2[i]);
adj[v2[i]].pb(v1[i]);
}
set<ii> usedEdges;
RE(h,nh) {
// bfs
vi dist; dist.assign(nv, -1);
queue<int> q;
q.push(h); dist[h] = 0;
while(!q.empty()) {
int u = q.front(); q.pop();
FOR(v,adj[u]) {
if(dist[v] != -1) continue;
dist[v] = dist[u] + 1;
usedEdges.insert({min(u,v),max(u,v)});
}
}
}
RE(i,nv) adj[i].clear();
FOR(p,usedEdges) adj[p.fi].pb(p.se);
RE(i,nv) {
writeSmallInt(adj[i].size());
FOR(v,adj[i]) writeSmallInt(v);
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define FOR(a,b) for(auto& a : b)
#define all(a) a.begin(), a.end()
#define INF 1e9
#define EPS 1e-9
#define pb push_back
#define popb pop_back
#define fi first
#define se second
int readSmallInt() {
int res = 0;
RE(i,10) {
bool b = decode_bit();
if(b) res |= (1<<i);
}
return res;
}
void decode(int nv, int nh) {
// reconstruct graph
vector<vi> adj; adj.resize(nv);
RE(u,nv) {
int sz = readSmallInt();
RE(j,sz) {
int v = readSmallInt();
adj[u].pb(v);
adj[v].pb(u);
}
}
RE(h,nh) {
// bfs
vi dist; dist.assign(nv, -1);
queue<int> q;
q.push(h); dist[h] = 0;
while(!q.empty()) {
int u = q.front(); q.pop();
hops(h,u,dist[u]);
FOR(v,adj[u]) {
if(dist[v] != -1) continue;
dist[v] = dist[u] + 1;
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
11912 KB |
function hops(h,c,d) must be called exactly N×H times |
2 |
Incorrect |
3 ms |
4588 KB |
function hops(h,c,d) must be called exactly N×H times |
3 |
Incorrect |
9 ms |
4840 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Incorrect |
3 ms |
4580 KB |
function hops(h,c,d) must be called exactly N×H times |
5 |
Incorrect |
14 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
34 ms |
5588 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
9 ms |
4712 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
12 ms |
4964 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
11 ms |
4820 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
9 ms |
4704 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
52 ms |
5656 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
11 ms |
4844 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
13 ms |
5032 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
34 ms |
5420 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
33 ms |
5536 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
33 ms |
5828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
29 ms |
5332 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
74 ms |
6332 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
86 ms |
6408 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
39 ms |
5936 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
91 ms |
6712 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
11912 KB |
function hops(h,c,d) must be called exactly N×H times |
2 |
Incorrect |
3 ms |
4588 KB |
function hops(h,c,d) must be called exactly N×H times |
3 |
Incorrect |
9 ms |
4840 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Incorrect |
3 ms |
4580 KB |
function hops(h,c,d) must be called exactly N×H times |
5 |
Incorrect |
14 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
34 ms |
5588 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
9 ms |
4712 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
12 ms |
4964 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
11 ms |
4820 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
9 ms |
4704 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
52 ms |
5656 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
11 ms |
4844 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
13 ms |
5032 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
34 ms |
5420 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
33 ms |
5536 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
33 ms |
5828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
29 ms |
5332 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
74 ms |
6332 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
86 ms |
6408 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
39 ms |
5936 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
91 ms |
6712 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
11912 KB |
function hops(h,c,d) must be called exactly N×H times |
2 |
Incorrect |
3 ms |
4588 KB |
function hops(h,c,d) must be called exactly N×H times |
3 |
Incorrect |
9 ms |
4840 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Incorrect |
3 ms |
4580 KB |
function hops(h,c,d) must be called exactly N×H times |
5 |
Incorrect |
14 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
34 ms |
5588 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
9 ms |
4712 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
12 ms |
4964 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
11 ms |
4820 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
9 ms |
4704 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
52 ms |
5656 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
11 ms |
4844 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
13 ms |
5032 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
34 ms |
5420 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
33 ms |
5536 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
33 ms |
5828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
29 ms |
5332 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
74 ms |
6332 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
86 ms |
6408 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
39 ms |
5936 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
91 ms |
6712 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
346 ms |
11912 KB |
function hops(h,c,d) must be called exactly N×H times |
2 |
Incorrect |
3 ms |
4588 KB |
function hops(h,c,d) must be called exactly N×H times |
3 |
Incorrect |
9 ms |
4840 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Incorrect |
3 ms |
4580 KB |
function hops(h,c,d) must be called exactly N×H times |
5 |
Incorrect |
14 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
34 ms |
5588 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
9 ms |
4712 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
12 ms |
4964 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
11 ms |
4820 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
15 ms |
5100 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
9 ms |
4704 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
52 ms |
5656 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
11 ms |
4844 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
13 ms |
5032 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
34 ms |
5420 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
33 ms |
5536 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
33 ms |
5828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
29 ms |
5332 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
74 ms |
6332 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
86 ms |
6408 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
39 ms |
5936 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
91 ms |
6712 KB |
function hops(h,c,d) must be called exactly N×H times |