#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
int dis[1001][37];
vector<int>adj[1001];
void reset(int n, int h){
for(int i = 0; i < n; i++){
adj[i].clear();
for(int j = 0; j < h; j++) dis[i][j] = INT_MAX;
}
}
void encode(int n, int h, int p, int a[], int b[]){
reset(n,h);
for(int i = 0; i < p; i++){
adj[a[i]].push_back(b[i]);
adj[b[i]].push_back(a[i]);
}
for(int i = 0; i < h; i++){
dis[i][i] = 0;
set<pair<int,int>>bfs;
bfs.insert({0,i});
while(bfs.size()){
auto x = *bfs.begin();
bfs.erase(x);
if(dis[x.second][i] < x.first) continue;
for(auto s:adj[x.second]){
if(dis[x.second][i] + 1 < dis[s][i]){
dis[s][i] = dis[x.second][i]+ 1;
bfs.insert({dis[x.second][i] + 1, s});
}
}
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < h; j++){
for(int k = 0; k < 10; k++){
if(dis[i][j] & (1 << k)) encode_bit(1);
else encode_bit(0);
}
}
}
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
int dis[1001][37];
void reset(int n, int h){
for(int i = 0; i < n; i++){
for(int j = 0; j < h; j++) dis[i][j] = 0;
}
}
void decode(int n, int h){
reset(n,h);
for(int i = 0; i < n; i++){
for(int j = 0; j < h; j++){
for(int k = 0; k < 10; k++){
dis[i][j] += (1 << decode_bit());
}
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < h; j++){
hops(j,i,dis[i][j]);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
274 ms |
12752 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4608 KB |
wrong parameter |
3 |
Incorrect |
66 ms |
7656 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
wrong parameter |
5 |
Incorrect |
104 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
74 ms |
7980 KB |
Output isn't correct |
7 |
Incorrect |
91 ms |
8380 KB |
Output isn't correct |
8 |
Incorrect |
89 ms |
7692 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7824 KB |
Output isn't correct |
10 |
Incorrect |
78 ms |
7960 KB |
Output isn't correct |
11 |
Incorrect |
91 ms |
8060 KB |
Output isn't correct |
12 |
Incorrect |
87 ms |
7784 KB |
Output isn't correct |
13 |
Incorrect |
97 ms |
8544 KB |
Output isn't correct |
14 |
Incorrect |
83 ms |
7900 KB |
Output isn't correct |
15 |
Incorrect |
74 ms |
8060 KB |
Output isn't correct |
16 |
Incorrect |
109 ms |
8364 KB |
Output isn't correct |
17 |
Incorrect |
92 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8640 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8276 KB |
Output isn't correct |
20 |
Incorrect |
119 ms |
8940 KB |
Output isn't correct |
21 |
Incorrect |
117 ms |
9128 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8624 KB |
Output isn't correct |
23 |
Incorrect |
122 ms |
9240 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
274 ms |
12752 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4608 KB |
wrong parameter |
3 |
Incorrect |
66 ms |
7656 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
wrong parameter |
5 |
Incorrect |
104 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
74 ms |
7980 KB |
Output isn't correct |
7 |
Incorrect |
91 ms |
8380 KB |
Output isn't correct |
8 |
Incorrect |
89 ms |
7692 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7824 KB |
Output isn't correct |
10 |
Incorrect |
78 ms |
7960 KB |
Output isn't correct |
11 |
Incorrect |
91 ms |
8060 KB |
Output isn't correct |
12 |
Incorrect |
87 ms |
7784 KB |
Output isn't correct |
13 |
Incorrect |
97 ms |
8544 KB |
Output isn't correct |
14 |
Incorrect |
83 ms |
7900 KB |
Output isn't correct |
15 |
Incorrect |
74 ms |
8060 KB |
Output isn't correct |
16 |
Incorrect |
109 ms |
8364 KB |
Output isn't correct |
17 |
Incorrect |
92 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8640 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8276 KB |
Output isn't correct |
20 |
Incorrect |
119 ms |
8940 KB |
Output isn't correct |
21 |
Incorrect |
117 ms |
9128 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8624 KB |
Output isn't correct |
23 |
Incorrect |
122 ms |
9240 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
274 ms |
12752 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4608 KB |
wrong parameter |
3 |
Incorrect |
66 ms |
7656 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
wrong parameter |
5 |
Incorrect |
104 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
74 ms |
7980 KB |
Output isn't correct |
7 |
Incorrect |
91 ms |
8380 KB |
Output isn't correct |
8 |
Incorrect |
89 ms |
7692 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7824 KB |
Output isn't correct |
10 |
Incorrect |
78 ms |
7960 KB |
Output isn't correct |
11 |
Incorrect |
91 ms |
8060 KB |
Output isn't correct |
12 |
Incorrect |
87 ms |
7784 KB |
Output isn't correct |
13 |
Incorrect |
97 ms |
8544 KB |
Output isn't correct |
14 |
Incorrect |
83 ms |
7900 KB |
Output isn't correct |
15 |
Incorrect |
74 ms |
8060 KB |
Output isn't correct |
16 |
Incorrect |
109 ms |
8364 KB |
Output isn't correct |
17 |
Incorrect |
92 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8640 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8276 KB |
Output isn't correct |
20 |
Incorrect |
119 ms |
8940 KB |
Output isn't correct |
21 |
Incorrect |
117 ms |
9128 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8624 KB |
Output isn't correct |
23 |
Incorrect |
122 ms |
9240 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
274 ms |
12752 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
4608 KB |
wrong parameter |
3 |
Incorrect |
66 ms |
7656 KB |
Output isn't correct |
4 |
Incorrect |
4 ms |
4604 KB |
wrong parameter |
5 |
Incorrect |
104 ms |
7616 KB |
Output isn't correct |
6 |
Incorrect |
74 ms |
7980 KB |
Output isn't correct |
7 |
Incorrect |
91 ms |
8380 KB |
Output isn't correct |
8 |
Incorrect |
89 ms |
7692 KB |
Output isn't correct |
9 |
Incorrect |
82 ms |
7824 KB |
Output isn't correct |
10 |
Incorrect |
78 ms |
7960 KB |
Output isn't correct |
11 |
Incorrect |
91 ms |
8060 KB |
Output isn't correct |
12 |
Incorrect |
87 ms |
7784 KB |
Output isn't correct |
13 |
Incorrect |
97 ms |
8544 KB |
Output isn't correct |
14 |
Incorrect |
83 ms |
7900 KB |
Output isn't correct |
15 |
Incorrect |
74 ms |
8060 KB |
Output isn't correct |
16 |
Incorrect |
109 ms |
8364 KB |
Output isn't correct |
17 |
Incorrect |
92 ms |
8372 KB |
Output isn't correct |
18 |
Incorrect |
118 ms |
8640 KB |
Output isn't correct |
19 |
Incorrect |
99 ms |
8276 KB |
Output isn't correct |
20 |
Incorrect |
119 ms |
8940 KB |
Output isn't correct |
21 |
Incorrect |
117 ms |
9128 KB |
Output isn't correct |
22 |
Incorrect |
114 ms |
8624 KB |
Output isn't correct |
23 |
Incorrect |
122 ms |
9240 KB |
Output isn't correct |