#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[]){
srand(time(NULL));
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<100;i++){
int k=rand()%n;
deque<pair<int,int>>dq={{0,k}};
vector<bool>vis(n);
vis[k]=1;
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({rand(),{min(w,p.second),max(w,p.second)}});
mp[{min(w,p.second),max(w,p.second)}]=1;
}
dq.push_back({p.first+1,w});
}
}
}
int tot=360000/20;
while(tot--){
pair<int,int>pr;
if(pq.empty())pr={0,0};
else{
pr=pq.top().second;
pq.pop();
}
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<360000/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);
}
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);
for(auto &w:vct[p.second]){if(!vis[w]){dq.push_back({p.first+1,w});vis[w]=1;}}
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
316 ms |
15880 KB |
Output isn't correct |
2 |
Correct |
68 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
81 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
61 ms |
7796 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
90 ms |
8756 KB |
Output isn't correct |
6 |
Correct |
96 ms |
8756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
137 ms |
10132 KB |
Output isn't correct |
8 |
Incorrect |
77 ms |
7928 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
8100 KB |
Output isn't correct |
10 |
Incorrect |
89 ms |
8000 KB |
Output isn't correct |
11 |
Incorrect |
86 ms |
8356 KB |
Output isn't correct |
12 |
Correct |
89 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Incorrect |
126 ms |
9856 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
79 ms |
8096 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
8132 KB |
Output isn't correct |
16 |
Incorrect |
111 ms |
9100 KB |
Output isn't correct |
17 |
Incorrect |
108 ms |
9020 KB |
Output isn't correct |
18 |
Incorrect |
122 ms |
9632 KB |
Output isn't correct |
19 |
Incorrect |
123 ms |
8992 KB |
Output isn't correct |
20 |
Incorrect |
150 ms |
10104 KB |
Output isn't correct |
21 |
Incorrect |
158 ms |
10432 KB |
Output isn't correct |
22 |
Incorrect |
125 ms |
10248 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
152 ms |
10916 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
316 ms |
15880 KB |
Output isn't correct |
2 |
Correct |
68 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
81 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
61 ms |
7796 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
90 ms |
8756 KB |
Output isn't correct |
6 |
Correct |
96 ms |
8756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
137 ms |
10132 KB |
Output isn't correct |
8 |
Incorrect |
77 ms |
7928 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
8100 KB |
Output isn't correct |
10 |
Incorrect |
89 ms |
8000 KB |
Output isn't correct |
11 |
Incorrect |
86 ms |
8356 KB |
Output isn't correct |
12 |
Correct |
89 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Incorrect |
126 ms |
9856 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
79 ms |
8096 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
8132 KB |
Output isn't correct |
16 |
Incorrect |
111 ms |
9100 KB |
Output isn't correct |
17 |
Incorrect |
108 ms |
9020 KB |
Output isn't correct |
18 |
Incorrect |
122 ms |
9632 KB |
Output isn't correct |
19 |
Incorrect |
123 ms |
8992 KB |
Output isn't correct |
20 |
Incorrect |
150 ms |
10104 KB |
Output isn't correct |
21 |
Incorrect |
158 ms |
10432 KB |
Output isn't correct |
22 |
Incorrect |
125 ms |
10248 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
152 ms |
10916 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
316 ms |
15880 KB |
Output isn't correct |
2 |
Correct |
68 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
81 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
61 ms |
7796 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
90 ms |
8756 KB |
Output isn't correct |
6 |
Correct |
96 ms |
8756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
137 ms |
10132 KB |
Output isn't correct |
8 |
Incorrect |
77 ms |
7928 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
8100 KB |
Output isn't correct |
10 |
Incorrect |
89 ms |
8000 KB |
Output isn't correct |
11 |
Incorrect |
86 ms |
8356 KB |
Output isn't correct |
12 |
Correct |
89 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Incorrect |
126 ms |
9856 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
79 ms |
8096 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
8132 KB |
Output isn't correct |
16 |
Incorrect |
111 ms |
9100 KB |
Output isn't correct |
17 |
Incorrect |
108 ms |
9020 KB |
Output isn't correct |
18 |
Incorrect |
122 ms |
9632 KB |
Output isn't correct |
19 |
Incorrect |
123 ms |
8992 KB |
Output isn't correct |
20 |
Incorrect |
150 ms |
10104 KB |
Output isn't correct |
21 |
Incorrect |
158 ms |
10432 KB |
Output isn't correct |
22 |
Incorrect |
125 ms |
10248 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
152 ms |
10916 KB |
function hops(h,c,d) must be called exactly N×H times |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
316 ms |
15880 KB |
Output isn't correct |
2 |
Correct |
68 ms |
7660 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
3 |
Correct |
81 ms |
8080 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
4 |
Correct |
61 ms |
7796 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
5 |
Incorrect |
90 ms |
8756 KB |
Output isn't correct |
6 |
Correct |
96 ms |
8756 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
7 |
Incorrect |
137 ms |
10132 KB |
Output isn't correct |
8 |
Incorrect |
77 ms |
7928 KB |
Output isn't correct |
9 |
Incorrect |
84 ms |
8100 KB |
Output isn't correct |
10 |
Incorrect |
89 ms |
8000 KB |
Output isn't correct |
11 |
Incorrect |
86 ms |
8356 KB |
Output isn't correct |
12 |
Correct |
89 ms |
7976 KB |
Output is partially correct - 360000 call(s) of encode_bit() |
13 |
Incorrect |
126 ms |
9856 KB |
function hops(h,c,d) must be called exactly N×H times |
14 |
Incorrect |
79 ms |
8096 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
8132 KB |
Output isn't correct |
16 |
Incorrect |
111 ms |
9100 KB |
Output isn't correct |
17 |
Incorrect |
108 ms |
9020 KB |
Output isn't correct |
18 |
Incorrect |
122 ms |
9632 KB |
Output isn't correct |
19 |
Incorrect |
123 ms |
8992 KB |
Output isn't correct |
20 |
Incorrect |
150 ms |
10104 KB |
Output isn't correct |
21 |
Incorrect |
158 ms |
10432 KB |
Output isn't correct |
22 |
Incorrect |
125 ms |
10248 KB |
function hops(h,c,d) must be called exactly N×H times |
23 |
Incorrect |
152 ms |
10916 KB |
function hops(h,c,d) must be called exactly N×H times |