#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
#define ll long long
//#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> v[1010];
int dist[40][1010];
void bfs(int pos){
vector<bool> vis(1100,0);
queue<pair<int,int> >q;
q.push({pos,0});
while(!q.empty()){
int p=q.front().first;
int d=q.front().second;
q.pop();
if(vis[p])continue;
vis[p]=1;
dist[pos][p]=d;
for(int k:v[p])q.push({k,d+1});
}
}
void aggiungi(int k){
for(int i=9;i>=0;i--){
encode_bit((k&(1<<i))>0);
}
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
for(int i=0;i<ne;i++){
v[v1[i]].push_back(v2[i]);
v[v2[i]].push_back(v1[i]);
}
for(int i=0;i<nh;i++){
bfs(i);
}
for(int i=0;i<nh;i++){
for(int j=0;j<nv;j++){
aggiungi(dist[i][j]);
}
}
return;
}/*
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
}*/
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
#define ll long long
//#define int ll
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int c(){
int k=0;
for(int i=9;i>=0;i--){
k+=(1<<i)*decode_bit();
}
return k;
}
void decode(int nv, int nh){
for(int i=0;i<nh;i++){
for(int j=0;j<nv;j++){
hops(i,j,c());
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
429 ms |
18912 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
92 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
4752 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
82 ms |
8068 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8300 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
127 ms |
8484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
8016 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
95 ms |
8028 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
112 ms |
7936 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
150 ms |
8868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
97 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
145 ms |
8664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8596 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
151 ms |
9332 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
183 ms |
9192 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
141 ms |
8832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
158 ms |
9516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
429 ms |
18912 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
92 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
4752 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
82 ms |
8068 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8300 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
127 ms |
8484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
8016 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
95 ms |
8028 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
112 ms |
7936 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
150 ms |
8868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
97 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
145 ms |
8664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8596 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
151 ms |
9332 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
183 ms |
9192 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
141 ms |
8832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
158 ms |
9516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
429 ms |
18912 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
92 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
4752 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
82 ms |
8068 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8300 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
127 ms |
8484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
8016 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
95 ms |
8028 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
112 ms |
7936 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
150 ms |
8868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
97 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
145 ms |
8664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8596 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
151 ms |
9332 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
183 ms |
9192 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
141 ms |
8832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
158 ms |
9516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
429 ms |
18912 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
11 ms |
4736 KB |
Output is correct - 150 call(s) of encode_bit() |
3 |
Correct |
92 ms |
7696 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
4 |
Correct |
12 ms |
4752 KB |
Output is correct - 250 call(s) of encode_bit() |
5 |
Correct |
82 ms |
8068 KB |
Output is partially correct - 324000 call(s) of encode_bit() |
6 |
Correct |
93 ms |
8300 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Correct |
127 ms |
8484 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
8 |
Correct |
84 ms |
8016 KB |
Output is partially correct - 345960 call(s) of encode_bit() |
9 |
Correct |
95 ms |
7980 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
10 |
Correct |
95 ms |
8028 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
11 |
Correct |
97 ms |
8412 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
12 |
Correct |
112 ms |
7936 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Correct |
150 ms |
8868 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
14 |
Correct |
105 ms |
8056 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
15 |
Correct |
97 ms |
8288 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
16 |
Correct |
145 ms |
8664 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
17 |
Correct |
120 ms |
8596 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
18 |
Correct |
134 ms |
9212 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
19 |
Correct |
105 ms |
8456 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
20 |
Correct |
151 ms |
9332 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
21 |
Correct |
183 ms |
9192 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
22 |
Correct |
141 ms |
8832 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
23 |
Correct |
158 ms |
9516 KB |
Output is partially correct - 360000 call(s) of encode_bit() |