#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;
}
dq.push_back({p.first+1,w});
}
}
}
int tot=16000000/20;
while(tot){
pair<int,int>pr;
if(pq.empty())pr={0,0};
else{
pr=pq.top().second;
pq.pop();
}
tot--;
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);
}
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 |
Correct |
2771 ms |
144480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2352 ms |
138408 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Correct |
2461 ms |
138952 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
4 |
Correct |
2381 ms |
138152 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Correct |
2498 ms |
139280 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
6 |
Correct |
2546 ms |
139552 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
7 |
Correct |
2700 ms |
140368 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
8 |
Correct |
2452 ms |
138720 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
9 |
Correct |
2527 ms |
138820 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
10 |
Correct |
2596 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
11 |
Correct |
2485 ms |
138944 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
12 |
Correct |
2456 ms |
138748 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
13 |
Correct |
2546 ms |
140216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
14 |
Correct |
2493 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
15 |
Correct |
2526 ms |
138940 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
16 |
Correct |
2583 ms |
139480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
17 |
Correct |
2695 ms |
139488 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
18 |
Correct |
2588 ms |
139996 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
19 |
Correct |
2564 ms |
139700 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
20 |
Correct |
2503 ms |
140464 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
21 |
Correct |
2576 ms |
140588 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
22 |
Correct |
2548 ms |
140612 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
23 |
Correct |
2510 ms |
141312 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2771 ms |
144480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2352 ms |
138408 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Correct |
2461 ms |
138952 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
4 |
Correct |
2381 ms |
138152 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Correct |
2498 ms |
139280 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
6 |
Correct |
2546 ms |
139552 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
7 |
Correct |
2700 ms |
140368 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
8 |
Correct |
2452 ms |
138720 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
9 |
Correct |
2527 ms |
138820 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
10 |
Correct |
2596 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
11 |
Correct |
2485 ms |
138944 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
12 |
Correct |
2456 ms |
138748 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
13 |
Correct |
2546 ms |
140216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
14 |
Correct |
2493 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
15 |
Correct |
2526 ms |
138940 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
16 |
Correct |
2583 ms |
139480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
17 |
Correct |
2695 ms |
139488 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
18 |
Correct |
2588 ms |
139996 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
19 |
Correct |
2564 ms |
139700 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
20 |
Correct |
2503 ms |
140464 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
21 |
Correct |
2576 ms |
140588 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
22 |
Correct |
2548 ms |
140612 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
23 |
Correct |
2510 ms |
141312 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2771 ms |
144480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2352 ms |
138408 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Correct |
2461 ms |
138952 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
4 |
Correct |
2381 ms |
138152 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Correct |
2498 ms |
139280 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
6 |
Correct |
2546 ms |
139552 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
7 |
Correct |
2700 ms |
140368 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
8 |
Correct |
2452 ms |
138720 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
9 |
Correct |
2527 ms |
138820 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
10 |
Correct |
2596 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
11 |
Correct |
2485 ms |
138944 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
12 |
Correct |
2456 ms |
138748 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
13 |
Correct |
2546 ms |
140216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
14 |
Correct |
2493 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
15 |
Correct |
2526 ms |
138940 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
16 |
Correct |
2583 ms |
139480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
17 |
Correct |
2695 ms |
139488 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
18 |
Correct |
2588 ms |
139996 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
19 |
Correct |
2564 ms |
139700 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
20 |
Correct |
2503 ms |
140464 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
21 |
Correct |
2576 ms |
140588 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
22 |
Correct |
2548 ms |
140612 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
23 |
Correct |
2510 ms |
141312 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2771 ms |
144480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
2 |
Correct |
2352 ms |
138408 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
3 |
Correct |
2461 ms |
138952 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
4 |
Correct |
2381 ms |
138152 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
5 |
Correct |
2498 ms |
139280 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
6 |
Correct |
2546 ms |
139552 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
7 |
Correct |
2700 ms |
140368 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
8 |
Correct |
2452 ms |
138720 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
9 |
Correct |
2527 ms |
138820 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
10 |
Correct |
2596 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
11 |
Correct |
2485 ms |
138944 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
12 |
Correct |
2456 ms |
138748 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
13 |
Correct |
2546 ms |
140216 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
14 |
Correct |
2493 ms |
138660 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
15 |
Correct |
2526 ms |
138940 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
16 |
Correct |
2583 ms |
139480 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
17 |
Correct |
2695 ms |
139488 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
18 |
Correct |
2588 ms |
139996 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
19 |
Correct |
2564 ms |
139700 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
20 |
Correct |
2503 ms |
140464 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
21 |
Correct |
2576 ms |
140588 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
22 |
Correct |
2548 ms |
140612 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |
23 |
Correct |
2510 ms |
141312 KB |
Output is partially correct - 16000000 call(s) of encode_bit() |