#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void encode(int n, int h, int m, int *a, int *b) {
vector<pair<int,int>>V[n];
int uzyte[m], odl[n];
rep(i, m) {
uzyte[i]=0;
V[a[i]].pb({b[i], i});
V[b[i]].pb({a[i], i});
}
rep(i, h) {
rep(j, n) odl[j]=1000000007;
queue<int>q;
q.push(i);
odl[i]=0;
while(!q.empty()) {
int p=q.front(); q.pop();
for(auto j : V[p]) if(odl[j.st]>odl[p]+1) {
odl[j.st]=odl[p]+1;
q.push(j.st);
uzyte[j.nd]=1;
}
}
}
vector<int>T[n];
rep(i, m) if(uzyte[i]) {
T[a[i]].pb(b[i]);
T[b[i]].pb(a[i]);
}
rep(i, h) rep(j, 10) encode_bit((i&(1<<j))>0);
rep(i, n) {
rep(j, 10) encode_bit((T[i].size()&(1<<j))>0);
for(auto j : T[i]) {
rep(l, 10) encode_bit((j&(1<<l))>0);
}
}
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void decode(int n, int h) {
vector<int>V[n];
rep(i, n) {
int a=0;
rep(j, 10) a+=decode_bit()*(1<<j);
rep(j, a) {
int x=0;
rep(l, 10) x+=decode_bit()*(1<<l);
V[i].pb(x);
}
}
rep(i, h) {
int odl[n];
rep(j, n) odl[j]=1000000007;
queue<int>q;
q.push(i);
odl[i]=0;
while(!q.empty()) {
int p=q.front(); q.pop();
for(auto j : V[p]) if(odl[j]>odl[p]+1) {
odl[j]=odl[p]+1;
q.push(j);
}
}
rep(j, n) hops(i, j, odl[j]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
394 ms |
16632 KB |
too many decode_bit() calls |
2 |
Incorrect |
2 ms |
4476 KB |
wrong parameter |
3 |
Incorrect |
27 ms |
5540 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
50 ms |
6812 KB |
too many decode_bit() calls |
6 |
Incorrect |
54 ms |
6884 KB |
too many decode_bit() calls |
7 |
Incorrect |
95 ms |
9008 KB |
too many decode_bit() calls |
8 |
Incorrect |
19 ms |
5224 KB |
too many decode_bit() calls |
9 |
Incorrect |
20 ms |
5328 KB |
too many decode_bit() calls |
10 |
Incorrect |
23 ms |
5348 KB |
too many decode_bit() calls |
11 |
Incorrect |
39 ms |
6096 KB |
too many decode_bit() calls |
12 |
Incorrect |
13 ms |
5076 KB |
too many decode_bit() calls |
13 |
Incorrect |
100 ms |
8144 KB |
too many decode_bit() calls |
14 |
Incorrect |
20 ms |
5348 KB |
too many decode_bit() calls |
15 |
Incorrect |
21 ms |
5472 KB |
wrong parameter |
16 |
Incorrect |
62 ms |
6744 KB |
too many decode_bit() calls |
17 |
Incorrect |
46 ms |
6764 KB |
too many decode_bit() calls |
18 |
Incorrect |
82 ms |
7688 KB |
too many decode_bit() calls |
19 |
Incorrect |
53 ms |
7024 KB |
too many decode_bit() calls |
20 |
Incorrect |
109 ms |
8584 KB |
too many decode_bit() calls |
21 |
Incorrect |
98 ms |
8832 KB |
too many decode_bit() calls |
22 |
Incorrect |
121 ms |
9068 KB |
too many decode_bit() calls |
23 |
Incorrect |
133 ms |
10100 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
394 ms |
16632 KB |
too many decode_bit() calls |
2 |
Incorrect |
2 ms |
4476 KB |
wrong parameter |
3 |
Incorrect |
27 ms |
5540 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
50 ms |
6812 KB |
too many decode_bit() calls |
6 |
Incorrect |
54 ms |
6884 KB |
too many decode_bit() calls |
7 |
Incorrect |
95 ms |
9008 KB |
too many decode_bit() calls |
8 |
Incorrect |
19 ms |
5224 KB |
too many decode_bit() calls |
9 |
Incorrect |
20 ms |
5328 KB |
too many decode_bit() calls |
10 |
Incorrect |
23 ms |
5348 KB |
too many decode_bit() calls |
11 |
Incorrect |
39 ms |
6096 KB |
too many decode_bit() calls |
12 |
Incorrect |
13 ms |
5076 KB |
too many decode_bit() calls |
13 |
Incorrect |
100 ms |
8144 KB |
too many decode_bit() calls |
14 |
Incorrect |
20 ms |
5348 KB |
too many decode_bit() calls |
15 |
Incorrect |
21 ms |
5472 KB |
wrong parameter |
16 |
Incorrect |
62 ms |
6744 KB |
too many decode_bit() calls |
17 |
Incorrect |
46 ms |
6764 KB |
too many decode_bit() calls |
18 |
Incorrect |
82 ms |
7688 KB |
too many decode_bit() calls |
19 |
Incorrect |
53 ms |
7024 KB |
too many decode_bit() calls |
20 |
Incorrect |
109 ms |
8584 KB |
too many decode_bit() calls |
21 |
Incorrect |
98 ms |
8832 KB |
too many decode_bit() calls |
22 |
Incorrect |
121 ms |
9068 KB |
too many decode_bit() calls |
23 |
Incorrect |
133 ms |
10100 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
394 ms |
16632 KB |
too many decode_bit() calls |
2 |
Incorrect |
2 ms |
4476 KB |
wrong parameter |
3 |
Incorrect |
27 ms |
5540 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
50 ms |
6812 KB |
too many decode_bit() calls |
6 |
Incorrect |
54 ms |
6884 KB |
too many decode_bit() calls |
7 |
Incorrect |
95 ms |
9008 KB |
too many decode_bit() calls |
8 |
Incorrect |
19 ms |
5224 KB |
too many decode_bit() calls |
9 |
Incorrect |
20 ms |
5328 KB |
too many decode_bit() calls |
10 |
Incorrect |
23 ms |
5348 KB |
too many decode_bit() calls |
11 |
Incorrect |
39 ms |
6096 KB |
too many decode_bit() calls |
12 |
Incorrect |
13 ms |
5076 KB |
too many decode_bit() calls |
13 |
Incorrect |
100 ms |
8144 KB |
too many decode_bit() calls |
14 |
Incorrect |
20 ms |
5348 KB |
too many decode_bit() calls |
15 |
Incorrect |
21 ms |
5472 KB |
wrong parameter |
16 |
Incorrect |
62 ms |
6744 KB |
too many decode_bit() calls |
17 |
Incorrect |
46 ms |
6764 KB |
too many decode_bit() calls |
18 |
Incorrect |
82 ms |
7688 KB |
too many decode_bit() calls |
19 |
Incorrect |
53 ms |
7024 KB |
too many decode_bit() calls |
20 |
Incorrect |
109 ms |
8584 KB |
too many decode_bit() calls |
21 |
Incorrect |
98 ms |
8832 KB |
too many decode_bit() calls |
22 |
Incorrect |
121 ms |
9068 KB |
too many decode_bit() calls |
23 |
Incorrect |
133 ms |
10100 KB |
too many decode_bit() calls |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
394 ms |
16632 KB |
too many decode_bit() calls |
2 |
Incorrect |
2 ms |
4476 KB |
wrong parameter |
3 |
Incorrect |
27 ms |
5540 KB |
too many decode_bit() calls |
4 |
Incorrect |
2 ms |
4580 KB |
wrong parameter |
5 |
Incorrect |
50 ms |
6812 KB |
too many decode_bit() calls |
6 |
Incorrect |
54 ms |
6884 KB |
too many decode_bit() calls |
7 |
Incorrect |
95 ms |
9008 KB |
too many decode_bit() calls |
8 |
Incorrect |
19 ms |
5224 KB |
too many decode_bit() calls |
9 |
Incorrect |
20 ms |
5328 KB |
too many decode_bit() calls |
10 |
Incorrect |
23 ms |
5348 KB |
too many decode_bit() calls |
11 |
Incorrect |
39 ms |
6096 KB |
too many decode_bit() calls |
12 |
Incorrect |
13 ms |
5076 KB |
too many decode_bit() calls |
13 |
Incorrect |
100 ms |
8144 KB |
too many decode_bit() calls |
14 |
Incorrect |
20 ms |
5348 KB |
too many decode_bit() calls |
15 |
Incorrect |
21 ms |
5472 KB |
wrong parameter |
16 |
Incorrect |
62 ms |
6744 KB |
too many decode_bit() calls |
17 |
Incorrect |
46 ms |
6764 KB |
too many decode_bit() calls |
18 |
Incorrect |
82 ms |
7688 KB |
too many decode_bit() calls |
19 |
Incorrect |
53 ms |
7024 KB |
too many decode_bit() calls |
20 |
Incorrect |
109 ms |
8584 KB |
too many decode_bit() calls |
21 |
Incorrect |
98 ms |
8832 KB |
too many decode_bit() calls |
22 |
Incorrect |
121 ms |
9068 KB |
too many decode_bit() calls |
23 |
Incorrect |
133 ms |
10100 KB |
too many decode_bit() calls |