#include<bits/stdc++.h>
#include<grader.h>
#include<encoder.h>
using namespace std;
//Types
using ll = long long;
using db = double;
//Vectors
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
//things
#define f first
#define s second
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);
vector<ll> connect[20007];
bool visited[1007][1007];
ll dist[1007][1007];
void bfs(int x){
queue<ll> q;
q.push(x);
visited[x][x] = true;
while(!q.empty()){
ll u = q.front();
q.pop();
for(auto v: connect[u]){
if(!visited[x][v]){
dist[x][v] = dist[x][u] + 1;
visited[x][v] = true;
q.push(v);
}
}
}
}
void encode(int n, int h, int p, int a[], int b[]){
for(ll i = 0; i < p; i++){
connect[a[i]].pb(b[i]);
connect[b[i]].pb(a[i]);
}
for(ll i = 0; i < h; i++){
bfs(i);
for(ll j = 0; j < n; j++){
for(ll bit = 0; bit < 10; bit++){
if(dist[i][j] & (1<<bit)){
encode_bit(1);
}
else encode_bit(0);
}
// cout<<dist[i][j]<<" ";
}
// cout<<"\n";
}
// for(ll j = 0; j < n; j++){
//
// cout<<dist[i][j]<<" ";
// }
// cout<<"\n";
}
// int a[7] = {0, 0, 0, 0, 1, 1, 1};
// int b[7] = {1, 2, 3, 4, 2, 3, 4};
//
// int main(){
//
// encode(5, 3, 7, a, b);
// }
#include<bits/stdc++.h>
#include<grader.h>
#include<decoder.h>
using namespace std;
//Types
using ll = long long;
using db = double;
//Vectors
#define pb push_back
#define sz(vec) ((ll)vec.size())
#define all(vec) vec.begin(), vec.end()
//things
#define f first
#define s second
const int SMALLINF = 1e9 + 7;
const ll BIGINF = ((ll)1e18) + 7;
#define Speeed ios::sync_with_stdio(0);cin.tie(NULL); cout.tie(NULL);
void decode(int n, int h){
for(ll i = 0; i < h; i++){
for(ll j = 0; j < n; j++){
ll val = 0;
for(ll bit = 0; bit < 10; bit++){
val+=(decode_bit() * (1<<bit));
}
hops(i, j, val);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
246 ms |
16120 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4996 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
8252 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
5124 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
73 ms |
8344 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
8644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
89 ms |
9144 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
86 ms |
8272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
67 ms |
8452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
75 ms |
8324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
97 ms |
9536 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
75 ms |
8496 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
9360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
87 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
121 ms |
9824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
96 ms |
8996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
107 ms |
10072 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
138 ms |
10204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
87 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
116 ms |
10732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
246 ms |
16120 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4996 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
8252 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
5124 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
73 ms |
8344 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
8644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
89 ms |
9144 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
86 ms |
8272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
67 ms |
8452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
75 ms |
8324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
97 ms |
9536 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
75 ms |
8496 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
9360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
87 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
121 ms |
9824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
96 ms |
8996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
107 ms |
10072 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
138 ms |
10204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
87 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
116 ms |
10732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
246 ms |
16120 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4996 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
8252 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
5124 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
73 ms |
8344 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
8644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
89 ms |
9144 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
86 ms |
8272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
67 ms |
8452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
75 ms |
8324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
97 ms |
9536 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
75 ms |
8496 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
9360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
87 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
121 ms |
9824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
96 ms |
8996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
107 ms |
10072 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
138 ms |
10204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
87 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
116 ms |
10732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
246 ms |
16120 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
3 ms |
4996 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
87 ms |
8252 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
4 ms |
5124 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
73 ms |
8344 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
78 ms |
8644 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
89 ms |
9144 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
86 ms |
8272 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
67 ms |
8452 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
75 ms |
8324 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
102 ms |
8556 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
93 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
97 ms |
9536 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8376 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
75 ms |
8496 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
96 ms |
9360 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
87 ms |
9328 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
121 ms |
9824 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
96 ms |
8996 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
107 ms |
10072 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
138 ms |
10204 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
87 ms |
9512 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
116 ms |
10732 KB |
Output is partially correct - 360000 call(s) of encode_bit() |