#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, int bits) {
RE(i,bits) {
bool b = false;
if(x & (1<<i)) b = 1;
encode_bit(b);
}
}
int maxBits(int x) {
int mx = 0;
RE(i,10) if(x&(1<<i)) mx = max(mx, i+1);
return mx;
}
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]);
}
vector<vi> dist; dist.resize(nh);
RE(h,nh) {
// bfs
dist[h].assign(nv,-1);
queue<int> q;
q.push(h); dist[h][h] = 0;
while(!q.empty()) {
int u = q.front(); q.pop();
FOR(v,adj[u]) {
if(dist[h][v] != -1) continue;
dist[h][v] = dist[h][u] + 1;
q.push(v);
}
}
}
RE(i,nh) RE(j,nv) writeSmallInt(dist[i][j], 10);
}
#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 bits) {
int res = 0;
RE(i,bits) {
bool b = decode_bit();
if(b) res |= (1<<i);
}
return res;
}
int maxBits(int x) {
int mx = 0;
RE(i,10) if(x&(1<<i)) mx = max(mx, i+1);
return mx;
}
void decode(int nv, int nh) {
// reconstruct graph
RE(i,nh) RE(j,nv) hops(i,j,readSmallInt(10));
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
432 ms |
12672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4584 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7308 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4584 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
91 ms |
7448 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
94 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
126 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
7576 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
91 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
104 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
98 ms |
7720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
135 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
97 ms |
7728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
98 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
114 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
129 ms |
8128 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
123 ms |
8320 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
112 ms |
7860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
144 ms |
8828 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
161 ms |
8728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
126 ms |
8524 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
183 ms |
9044 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
432 ms |
12672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4584 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7308 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4584 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
91 ms |
7448 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
94 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
126 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
7576 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
91 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
104 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
98 ms |
7720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
135 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
97 ms |
7728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
98 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
114 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
129 ms |
8128 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
123 ms |
8320 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
112 ms |
7860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
144 ms |
8828 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
161 ms |
8728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
126 ms |
8524 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
183 ms |
9044 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
432 ms |
12672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4584 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7308 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4584 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
91 ms |
7448 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
94 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
126 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
7576 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
91 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
104 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
98 ms |
7720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
135 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
97 ms |
7728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
98 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
114 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
129 ms |
8128 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
123 ms |
8320 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
112 ms |
7860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
144 ms |
8828 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
161 ms |
8728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
126 ms |
8524 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
183 ms |
9044 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
432 ms |
12672 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4584 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
79 ms |
7308 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4584 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
91 ms |
7448 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
94 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
126 ms |
8220 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
7576 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7772 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
91 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
104 ms |
7816 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
98 ms |
7720 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
135 ms |
8208 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
97 ms |
7728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
98 ms |
7688 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
114 ms |
8184 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
129 ms |
8128 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
123 ms |
8320 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
112 ms |
7860 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
144 ms |
8828 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
161 ms |
8728 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
126 ms |
8524 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
183 ms |
9044 KB |
Output is partially correct - 360000 call(s) of encode_bit() |