#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
static int n, h, m;
static int ans[40][1010];
static vector<int> g[1010];
void encode(int nv, int nh, int ne, int *v1, int *v2){
n = nv;
h = nh;
m = ne;
for(int i=0; i<m; i++) {
g[v1[i]].eb(v2[i]);
g[v2[i]].eb(v1[i]);
}
for(int s=0; s<h; s++) {
queue<int> q;
q.em(s);
ans[s][s] = 1;
while(q.size()) {
int x = q.front();
q.pop();
for(auto i : g[x]) {
if(ans[s][i]) continue;
ans[s][i] = ans[s][x] + 1;
q.em(i);
}
}
}
for(int i=0; i<h; i++) {
for(int j=0; j<n; j++) {
ans[i][j]--;
for(int k=0; k<10; k++) {
if(ans[i][j] & (1<<k)) encode_bit(1);
else encode_bit(0);
}
}
}
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
static int n, h;
void decode(int nv, int nh) {
n = nv;
h = nh;
for(int i=0; i<h; i++) {
for(int j=0; j<n; j++) {
int d = 0;
for(int k=0; k<10; k++) {
if(decode_bit()) d |= (1 << k);
}
hops(i, j, d);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
307 ms |
13960 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
86 ms |
7776 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
92 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8068 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
147 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7800 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
134 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8168 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
121 ms |
8500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
131 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
128 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
127 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
152 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
201 ms |
9156 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
155 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
307 ms |
13960 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
86 ms |
7776 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
92 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8068 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
147 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7800 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
134 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8168 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
121 ms |
8500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
131 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
128 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
127 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
152 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
201 ms |
9156 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
155 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
307 ms |
13960 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
86 ms |
7776 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
92 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8068 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
147 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7800 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
134 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8168 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
121 ms |
8500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
131 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
128 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
127 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
152 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
201 ms |
9156 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
155 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
307 ms |
13960 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
4 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
86 ms |
7776 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
3 ms |
4608 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
92 ms |
7744 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
99 ms |
8068 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
147 ms |
8388 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
101 ms |
7800 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
94 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
134 ms |
7928 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8168 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
7800 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
121 ms |
8500 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
7968 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
131 ms |
7940 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
128 ms |
8304 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
127 ms |
8428 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9032 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8296 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
152 ms |
8948 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
201 ms |
9156 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
129 ms |
8576 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
155 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |