#include <bits/stdc++.h>
#include <fstream>
#include "grader.h"
#include "encoder.h"
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
const int M = 1005;
vector<int> v[M];
long long dist[M];
void bfs(int s)
{
dist[s] = 0;
queue<int> q;
q.push(s);
while(!q.empty())
{
int x = q.front();
q.pop();
for(auto i : v[x])
{
if(dist[i] == INF)
{
q.push(i);
dist[i] = dist[x]+1;
}
}
}
}
void encode(int n, int h, int p, int a[], int b[])
{
for(int i = 0; i < p; i++)
{
v[a[i]].push_back(b[i]);
v[b[i]].push_back(a[i]);
}
for(int i = 0; i < h; i++)
{
for(int j = 0; j < n; j++)
{
dist[j] = INF;
}
bfs(i);
for(int j = 0; j < n; j++)
{
for(int cnt = 0; cnt < dist[j]; cnt++)
{
encode_bit(1);
}
encode_bit(0);
}
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
void decode(int n, int h)
{
for(int i = 0; i < h; i++)
{
for(int j = 0; j < n; j++)
{
long long cnt = 0;
while(decode_bit() != 0)
{
cnt++;
}
hops(i,j,cnt);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
10368 KB |
Output is partially correct - 89883 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4604 KB |
Output is correct - 29 call(s) of encode_bit() |
3 |
Correct |
38 ms |
5908 KB |
Output is partially correct - 147469 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 47 call(s) of encode_bit() |
5 |
Correct |
38 ms |
5664 KB |
Output is partially correct - 115163 call(s) of encode_bit() |
6 |
Correct |
45 ms |
5912 KB |
Output is partially correct - 131042 call(s) of encode_bit() |
7 |
Correct |
47 ms |
6052 KB |
Output is partially correct - 107153 call(s) of encode_bit() |
8 |
Correct |
132 ms |
10380 KB |
Output is partially correct - 724842 call(s) of encode_bit() |
9 |
Correct |
532 ms |
28708 KB |
Output is partially correct - 3045393 call(s) of encode_bit() |
10 |
Correct |
588 ms |
28436 KB |
Output is partially correct - 3014114 call(s) of encode_bit() |
11 |
Correct |
239 ms |
14596 KB |
Output is partially correct - 1233968 call(s) of encode_bit() |
12 |
Correct |
2244 ms |
98616 KB |
Output is partially correct - 11976266 call(s) of encode_bit() |
13 |
Correct |
339 ms |
18532 KB |
Output is partially correct - 1673494 call(s) of encode_bit() |
14 |
Correct |
1108 ms |
51984 KB |
Output is partially correct - 6033430 call(s) of encode_bit() |
15 |
Correct |
1059 ms |
56296 KB |
Output is partially correct - 6547737 call(s) of encode_bit() |
16 |
Correct |
548 ms |
30664 KB |
Output is partially correct - 3240093 call(s) of encode_bit() |
17 |
Correct |
534 ms |
29932 KB |
Output is partially correct - 3152959 call(s) of encode_bit() |
18 |
Correct |
160 ms |
10924 KB |
Output is partially correct - 683087 call(s) of encode_bit() |
19 |
Correct |
129 ms |
10584 KB |
Output is partially correct - 678468 call(s) of encode_bit() |
20 |
Correct |
201 ms |
12812 KB |
Output is partially correct - 900467 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 315504 call(s) of encode_bit() |
22 |
Correct |
64 ms |
7064 KB |
Output is partially correct - 202577 call(s) of encode_bit() |
23 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 190412 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
10368 KB |
Output is partially correct - 89883 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4604 KB |
Output is correct - 29 call(s) of encode_bit() |
3 |
Correct |
38 ms |
5908 KB |
Output is partially correct - 147469 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 47 call(s) of encode_bit() |
5 |
Correct |
38 ms |
5664 KB |
Output is partially correct - 115163 call(s) of encode_bit() |
6 |
Correct |
45 ms |
5912 KB |
Output is partially correct - 131042 call(s) of encode_bit() |
7 |
Correct |
47 ms |
6052 KB |
Output is partially correct - 107153 call(s) of encode_bit() |
8 |
Correct |
132 ms |
10380 KB |
Output is partially correct - 724842 call(s) of encode_bit() |
9 |
Correct |
532 ms |
28708 KB |
Output is partially correct - 3045393 call(s) of encode_bit() |
10 |
Correct |
588 ms |
28436 KB |
Output is partially correct - 3014114 call(s) of encode_bit() |
11 |
Correct |
239 ms |
14596 KB |
Output is partially correct - 1233968 call(s) of encode_bit() |
12 |
Correct |
2244 ms |
98616 KB |
Output is partially correct - 11976266 call(s) of encode_bit() |
13 |
Correct |
339 ms |
18532 KB |
Output is partially correct - 1673494 call(s) of encode_bit() |
14 |
Correct |
1108 ms |
51984 KB |
Output is partially correct - 6033430 call(s) of encode_bit() |
15 |
Correct |
1059 ms |
56296 KB |
Output is partially correct - 6547737 call(s) of encode_bit() |
16 |
Correct |
548 ms |
30664 KB |
Output is partially correct - 3240093 call(s) of encode_bit() |
17 |
Correct |
534 ms |
29932 KB |
Output is partially correct - 3152959 call(s) of encode_bit() |
18 |
Correct |
160 ms |
10924 KB |
Output is partially correct - 683087 call(s) of encode_bit() |
19 |
Correct |
129 ms |
10584 KB |
Output is partially correct - 678468 call(s) of encode_bit() |
20 |
Correct |
201 ms |
12812 KB |
Output is partially correct - 900467 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 315504 call(s) of encode_bit() |
22 |
Correct |
64 ms |
7064 KB |
Output is partially correct - 202577 call(s) of encode_bit() |
23 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 190412 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
10368 KB |
Output is partially correct - 89883 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4604 KB |
Output is correct - 29 call(s) of encode_bit() |
3 |
Correct |
38 ms |
5908 KB |
Output is partially correct - 147469 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 47 call(s) of encode_bit() |
5 |
Correct |
38 ms |
5664 KB |
Output is partially correct - 115163 call(s) of encode_bit() |
6 |
Correct |
45 ms |
5912 KB |
Output is partially correct - 131042 call(s) of encode_bit() |
7 |
Correct |
47 ms |
6052 KB |
Output is partially correct - 107153 call(s) of encode_bit() |
8 |
Correct |
132 ms |
10380 KB |
Output is partially correct - 724842 call(s) of encode_bit() |
9 |
Correct |
532 ms |
28708 KB |
Output is partially correct - 3045393 call(s) of encode_bit() |
10 |
Correct |
588 ms |
28436 KB |
Output is partially correct - 3014114 call(s) of encode_bit() |
11 |
Correct |
239 ms |
14596 KB |
Output is partially correct - 1233968 call(s) of encode_bit() |
12 |
Correct |
2244 ms |
98616 KB |
Output is partially correct - 11976266 call(s) of encode_bit() |
13 |
Correct |
339 ms |
18532 KB |
Output is partially correct - 1673494 call(s) of encode_bit() |
14 |
Correct |
1108 ms |
51984 KB |
Output is partially correct - 6033430 call(s) of encode_bit() |
15 |
Correct |
1059 ms |
56296 KB |
Output is partially correct - 6547737 call(s) of encode_bit() |
16 |
Correct |
548 ms |
30664 KB |
Output is partially correct - 3240093 call(s) of encode_bit() |
17 |
Correct |
534 ms |
29932 KB |
Output is partially correct - 3152959 call(s) of encode_bit() |
18 |
Correct |
160 ms |
10924 KB |
Output is partially correct - 683087 call(s) of encode_bit() |
19 |
Correct |
129 ms |
10584 KB |
Output is partially correct - 678468 call(s) of encode_bit() |
20 |
Correct |
201 ms |
12812 KB |
Output is partially correct - 900467 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 315504 call(s) of encode_bit() |
22 |
Correct |
64 ms |
7064 KB |
Output is partially correct - 202577 call(s) of encode_bit() |
23 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 190412 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
10368 KB |
Output is partially correct - 89883 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4604 KB |
Output is correct - 29 call(s) of encode_bit() |
3 |
Correct |
38 ms |
5908 KB |
Output is partially correct - 147469 call(s) of encode_bit() |
4 |
Correct |
2 ms |
4604 KB |
Output is correct - 47 call(s) of encode_bit() |
5 |
Correct |
38 ms |
5664 KB |
Output is partially correct - 115163 call(s) of encode_bit() |
6 |
Correct |
45 ms |
5912 KB |
Output is partially correct - 131042 call(s) of encode_bit() |
7 |
Correct |
47 ms |
6052 KB |
Output is partially correct - 107153 call(s) of encode_bit() |
8 |
Correct |
132 ms |
10380 KB |
Output is partially correct - 724842 call(s) of encode_bit() |
9 |
Correct |
532 ms |
28708 KB |
Output is partially correct - 3045393 call(s) of encode_bit() |
10 |
Correct |
588 ms |
28436 KB |
Output is partially correct - 3014114 call(s) of encode_bit() |
11 |
Correct |
239 ms |
14596 KB |
Output is partially correct - 1233968 call(s) of encode_bit() |
12 |
Correct |
2244 ms |
98616 KB |
Output is partially correct - 11976266 call(s) of encode_bit() |
13 |
Correct |
339 ms |
18532 KB |
Output is partially correct - 1673494 call(s) of encode_bit() |
14 |
Correct |
1108 ms |
51984 KB |
Output is partially correct - 6033430 call(s) of encode_bit() |
15 |
Correct |
1059 ms |
56296 KB |
Output is partially correct - 6547737 call(s) of encode_bit() |
16 |
Correct |
548 ms |
30664 KB |
Output is partially correct - 3240093 call(s) of encode_bit() |
17 |
Correct |
534 ms |
29932 KB |
Output is partially correct - 3152959 call(s) of encode_bit() |
18 |
Correct |
160 ms |
10924 KB |
Output is partially correct - 683087 call(s) of encode_bit() |
19 |
Correct |
129 ms |
10584 KB |
Output is partially correct - 678468 call(s) of encode_bit() |
20 |
Correct |
201 ms |
12812 KB |
Output is partially correct - 900467 call(s) of encode_bit() |
21 |
Correct |
104 ms |
8424 KB |
Output is partially correct - 315504 call(s) of encode_bit() |
22 |
Correct |
64 ms |
7064 KB |
Output is partially correct - 202577 call(s) of encode_bit() |
23 |
Correct |
77 ms |
7600 KB |
Output is partially correct - 190412 call(s) of encode_bit() |