#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=16000000;
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<16000000/20;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 |
2913 ms |
144472 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2635 ms |
138360 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Incorrect |
2687 ms |
138568 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
2657 ms |
138216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Incorrect |
2807 ms |
138700 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
2666 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
2692 ms |
139176 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
2546 ms |
138440 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
2515 ms |
138508 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
2574 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
2633 ms |
138716 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
2573 ms |
138404 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
3251 ms |
139416 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
2576 ms |
138560 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
2682 ms |
138500 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
2542 ms |
139148 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
2707 ms |
139308 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
2724 ms |
139412 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
2662 ms |
138844 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
2586 ms |
139968 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
2679 ms |
139868 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
2735 ms |
139428 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
2780 ms |
140308 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2913 ms |
144472 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2635 ms |
138360 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Incorrect |
2687 ms |
138568 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
2657 ms |
138216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Incorrect |
2807 ms |
138700 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
2666 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
2692 ms |
139176 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
2546 ms |
138440 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
2515 ms |
138508 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
2574 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
2633 ms |
138716 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
2573 ms |
138404 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
3251 ms |
139416 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
2576 ms |
138560 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
2682 ms |
138500 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
2542 ms |
139148 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
2707 ms |
139308 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
2724 ms |
139412 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
2662 ms |
138844 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
2586 ms |
139968 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
2679 ms |
139868 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
2735 ms |
139428 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
2780 ms |
140308 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2913 ms |
144472 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2635 ms |
138360 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Incorrect |
2687 ms |
138568 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
2657 ms |
138216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Incorrect |
2807 ms |
138700 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
2666 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
2692 ms |
139176 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
2546 ms |
138440 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
2515 ms |
138508 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
2574 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
2633 ms |
138716 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
2573 ms |
138404 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
3251 ms |
139416 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
2576 ms |
138560 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
2682 ms |
138500 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
2542 ms |
139148 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
2707 ms |
139308 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
2724 ms |
139412 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
2662 ms |
138844 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
2586 ms |
139968 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
2679 ms |
139868 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
2735 ms |
139428 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
2780 ms |
140308 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2913 ms |
144472 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2635 ms |
138360 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Incorrect |
2687 ms |
138568 KB |
function hops(h,c,d) must be called exactly N×H times |
4 |
Correct |
2657 ms |
138216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Incorrect |
2807 ms |
138700 KB |
function hops(h,c,d) must be called exactly N×H times |
6 |
Incorrect |
2666 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
7 |
Incorrect |
2692 ms |
139176 KB |
function hops(h,c,d) must be called exactly N×H times |
8 |
Incorrect |
2546 ms |
138440 KB |
function hops(h,c,d) must be called exactly N×H times |
9 |
Incorrect |
2515 ms |
138508 KB |
function hops(h,c,d) must be called exactly N×H times |
10 |
Incorrect |
2574 ms |
138864 KB |
function hops(h,c,d) must be called exactly N×H times |
11 |
Incorrect |
2633 ms |
138716 KB |
function hops(h,c,d) must be called exactly N×H times |
12 |
Incorrect |
2573 ms |
138404 KB |
function hops(h,c,d) must be called exactly N×H times |
13 |
Incorrect |
3251 ms |
139416 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
2576 ms |
138560 KB |
function hops(h,c,d) must be called exactly N×H times |
15 |
Incorrect |
2682 ms |
138500 KB |
function hops(h,c,d) must be called exactly N×H times |
16 |
Incorrect |
2542 ms |
139148 KB |
function hops(h,c,d) must be called exactly N×H times |
17 |
Incorrect |
2707 ms |
139308 KB |
function hops(h,c,d) must be called exactly N×H times |
18 |
Incorrect |
2724 ms |
139412 KB |
function hops(h,c,d) must be called exactly N×H times |
19 |
Incorrect |
2662 ms |
138844 KB |
function hops(h,c,d) must be called exactly N×H times |
20 |
Incorrect |
2586 ms |
139968 KB |
function hops(h,c,d) must be called exactly N×H times |
21 |
Incorrect |
2679 ms |
139868 KB |
function hops(h,c,d) must be called exactly N×H times |
22 |
Incorrect |
2735 ms |
139428 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
2780 ms |
140308 KB |
function hops(h,c,d) must be called exactly N×H times |