#include "grader.h"
#include "encoder.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int n, int h, int p, int v1[], int v2[]){
vector<int>vct[n];
for(int i=0;i<p;i++){
vct[v1[i]].push_back(v2[i]);
vct[v2[i]].push_back(v1[i]);
}
priority_queue<pair<int,pair<int,int>>>pq;
map<pair<int,int>,bool>mp;
for(int i=0;i<h;i++){
deque<pair<int,int>>dq={{0,i}};
vector<bool>vis(n);
while(dq.size()){
pair<int,int>p=dq.front();
dq.pop_front();
for(auto &w:vct[p.second]){
if(vis[w])continue;
vis[w]=1;
if(!mp[{min(w,p.second),max(w,p.second)}]){
pq.push({-p.first,{min(w,p.second),max(w,p.second)}});
mp[{min(w,p.second),max(w,p.second)}]=1;
}
}
}
}
int tot=360000;
while(tot>=20){
pair<int,int>pr;
if(pq.empty())pr={0,0};
else{
pr=pq.top().second;
pq.pop();
}
tot-=20;
for(int i=0;i<10;i++)encode_bit((!!(pr.first&(1<<i))));
for(int i=0;i<10;i++)encode_bit((!!(pr.second&(1<<i))));
}
}
#include "grader.h"
#include "decoder.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int n, int h) {
vector<int>vct[n];
for(int i=0;i<18000;i++){
int a=0,b=0;
for(int w=0;w<10;w++)a+=(1<<w)*decode_bit();
for(int w=0;w<10;w++)b+=(1<<w)*decode_bit();
vct[a].push_back(b);
vct[b].push_back(a);
}
int arr[h][n];
for(int i=0;i<h;i++){
deque<pair<int,int>>dq={{0,i}};
vector<bool>vis(n);
vis[i]=1;
while(dq.size()){
pair<int,int>p=dq.front();
dq.pop_front();
hops(i,p.second,p.first);
arr[i][p.second]=p.first;
for(auto &w:vct[p.second]){if(!vis[w]){dq.push_back({p.first+1,w});vis[w]=1;}}
}
}
}
Compilation message
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:14:9: warning: variable 'arr' set but not used [-Wunused-but-set-variable]
14 | int arr[h][n];
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
264 ms |
13712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
64 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Incorrect |
62 ms |
8068 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
58 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
73 ms |
8092 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
72 ms |
8328 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
90 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
66 ms |
7920 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
62 ms |
7960 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
60 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
68 ms |
8176 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
66 ms |
7928 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
115 ms |
8892 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
65 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
69 ms |
8208 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
81 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
89 ms |
8596 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
104 ms |
8828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
73 ms |
8472 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
97 ms |
9228 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
108 ms |
9356 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
81 ms |
8912 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
115 ms |
9696 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
264 ms |
13712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
64 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Incorrect |
62 ms |
8068 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
58 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
73 ms |
8092 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
72 ms |
8328 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
90 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
66 ms |
7920 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
62 ms |
7960 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
60 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
68 ms |
8176 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
66 ms |
7928 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
115 ms |
8892 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
65 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
69 ms |
8208 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
81 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
89 ms |
8596 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
104 ms |
8828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
73 ms |
8472 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
97 ms |
9228 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
108 ms |
9356 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
81 ms |
8912 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
115 ms |
9696 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
264 ms |
13712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
64 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Incorrect |
62 ms |
8068 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
58 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
73 ms |
8092 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
72 ms |
8328 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
90 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
66 ms |
7920 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
62 ms |
7960 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
60 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
68 ms |
8176 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
66 ms |
7928 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
115 ms |
8892 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
65 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
69 ms |
8208 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
81 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
89 ms |
8596 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
104 ms |
8828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
73 ms |
8472 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
97 ms |
9228 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
108 ms |
9356 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
81 ms |
8912 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
115 ms |
9696 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
264 ms |
13712 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
2 |
Correct |
64 ms |
7708 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Incorrect |
62 ms |
8068 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
58 ms |
7744 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
73 ms |
8092 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
72 ms |
8328 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
90 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
66 ms |
7920 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
62 ms |
7960 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
60 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
68 ms |
8176 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
66 ms |
7928 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
115 ms |
8892 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
65 ms |
8080 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
69 ms |
8208 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
81 ms |
8616 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
89 ms |
8596 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
104 ms |
8828 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
73 ms |
8472 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
97 ms |
9228 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
108 ms |
9356 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
81 ms |
8912 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
115 ms |
9696 KB |
function hops(h,c,d) must be called exactly N×H times |