#include<bits/stdc++.h>
#include "grader.h"
#include "encoder.h"
using namespace std;
vector<int> adj[1005];
bool vis[1005];
int dis[1005];
void binary (int n) {
for (int i = 0; i < 10; i++)
if ((1 << i) & n) encode_bit(1);
else encode_bit(0);
}
bool COOL[1001][1001];
void encode(int nv, int nh, int ne, int *v1, int *v2){
for (int i = 0; i < ne; i++) {
adj[v1[i]].push_back(v2[i]);
adj[v2[i]].push_back(v1[i]);
}
for (int s = 0; s < nh; s++) {
queue<int> q;
q.push(s);
vis[s] = 1;
while (!q.empty()) {
int v = q.front();
q.pop();
for (auto i : adj[v]) {
if (!vis[i]) {
vis[i] = 1;
dis[i] = dis[v] + 1;
q.push(i);
COOL[i][v] = COOL[v][i] = 1;
}
}
}
memset(vis,0,sizeof vis);
memset(dis,0,sizeof dis);
}
int ans = 0;
vector<pair<int,int> > v;
for (int i = 0; i < nv; i++)
for (int j = i; j < nv; j++)
if (COOL[i][j]) {
ans++;
v.push_back({i,j});
}
sort(v.begin(),v.end());
int cur = 0;
for (auto i : v) {
while (cur != i.first) {
binary(1023);
cur++;
}
binary(i.second);
}
binary(1022);
}
#include<bits/stdc++.h>
#include "grader.h"
#include "decoder.h"
using namespace std;
vector<int> adj[1005];
bool vis[1005];
int dis[1005];
void decode(int nv, int nh) {
int cur = 0;
while (cur <= nv) {
int s = 0;
for (int i = 0; i < 10; i++)
if (decode_bit())
s |= (1 << i);
if (s == 1022) break;
if (s == 1023) cur++;
adj[cur].push_back(s);
adj[s].push_back(cur);
}
for (int s = 0; s < nh; s++) {
hops(s,s,0);
queue<int> q;
q.push(s);
vis[s] = 1;
while (!q.empty()) {
int v = q.front();
q.pop();
for (auto i : adj[v]) {
if (!vis[i]) {
hops(s,i,dis[v] + 1);
vis[i] = 1;
dis[i] = dis[v] + 1;
q.push(i);
}
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
247 ms |
14576 KB |
wrong parameter |
2 |
Incorrect |
11 ms |
4744 KB |
wrong parameter |
3 |
Incorrect |
28 ms |
6408 KB |
wrong parameter |
4 |
Incorrect |
10 ms |
4756 KB |
wrong parameter |
5 |
Incorrect |
40 ms |
7296 KB |
wrong parameter |
6 |
Incorrect |
41 ms |
7444 KB |
wrong parameter |
7 |
Incorrect |
75 ms |
8452 KB |
wrong parameter |
8 |
Incorrect |
24 ms |
6144 KB |
wrong parameter |
9 |
Incorrect |
24 ms |
6272 KB |
wrong parameter |
10 |
Incorrect |
25 ms |
6408 KB |
wrong parameter |
11 |
Incorrect |
33 ms |
6704 KB |
wrong parameter |
12 |
Incorrect |
22 ms |
6144 KB |
wrong parameter |
13 |
Incorrect |
66 ms |
8368 KB |
wrong parameter |
14 |
Incorrect |
25 ms |
6372 KB |
wrong parameter |
15 |
Incorrect |
25 ms |
6272 KB |
wrong parameter |
16 |
Incorrect |
49 ms |
7252 KB |
wrong parameter |
17 |
Incorrect |
46 ms |
7040 KB |
wrong parameter |
18 |
Incorrect |
71 ms |
7656 KB |
wrong parameter |
19 |
Incorrect |
54 ms |
7432 KB |
wrong parameter |
20 |
Incorrect |
76 ms |
8368 KB |
wrong parameter |
21 |
Incorrect |
93 ms |
8420 KB |
wrong parameter |
22 |
Incorrect |
78 ms |
8448 KB |
wrong parameter |
23 |
Incorrect |
97 ms |
9204 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
247 ms |
14576 KB |
wrong parameter |
2 |
Incorrect |
11 ms |
4744 KB |
wrong parameter |
3 |
Incorrect |
28 ms |
6408 KB |
wrong parameter |
4 |
Incorrect |
10 ms |
4756 KB |
wrong parameter |
5 |
Incorrect |
40 ms |
7296 KB |
wrong parameter |
6 |
Incorrect |
41 ms |
7444 KB |
wrong parameter |
7 |
Incorrect |
75 ms |
8452 KB |
wrong parameter |
8 |
Incorrect |
24 ms |
6144 KB |
wrong parameter |
9 |
Incorrect |
24 ms |
6272 KB |
wrong parameter |
10 |
Incorrect |
25 ms |
6408 KB |
wrong parameter |
11 |
Incorrect |
33 ms |
6704 KB |
wrong parameter |
12 |
Incorrect |
22 ms |
6144 KB |
wrong parameter |
13 |
Incorrect |
66 ms |
8368 KB |
wrong parameter |
14 |
Incorrect |
25 ms |
6372 KB |
wrong parameter |
15 |
Incorrect |
25 ms |
6272 KB |
wrong parameter |
16 |
Incorrect |
49 ms |
7252 KB |
wrong parameter |
17 |
Incorrect |
46 ms |
7040 KB |
wrong parameter |
18 |
Incorrect |
71 ms |
7656 KB |
wrong parameter |
19 |
Incorrect |
54 ms |
7432 KB |
wrong parameter |
20 |
Incorrect |
76 ms |
8368 KB |
wrong parameter |
21 |
Incorrect |
93 ms |
8420 KB |
wrong parameter |
22 |
Incorrect |
78 ms |
8448 KB |
wrong parameter |
23 |
Incorrect |
97 ms |
9204 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
247 ms |
14576 KB |
wrong parameter |
2 |
Incorrect |
11 ms |
4744 KB |
wrong parameter |
3 |
Incorrect |
28 ms |
6408 KB |
wrong parameter |
4 |
Incorrect |
10 ms |
4756 KB |
wrong parameter |
5 |
Incorrect |
40 ms |
7296 KB |
wrong parameter |
6 |
Incorrect |
41 ms |
7444 KB |
wrong parameter |
7 |
Incorrect |
75 ms |
8452 KB |
wrong parameter |
8 |
Incorrect |
24 ms |
6144 KB |
wrong parameter |
9 |
Incorrect |
24 ms |
6272 KB |
wrong parameter |
10 |
Incorrect |
25 ms |
6408 KB |
wrong parameter |
11 |
Incorrect |
33 ms |
6704 KB |
wrong parameter |
12 |
Incorrect |
22 ms |
6144 KB |
wrong parameter |
13 |
Incorrect |
66 ms |
8368 KB |
wrong parameter |
14 |
Incorrect |
25 ms |
6372 KB |
wrong parameter |
15 |
Incorrect |
25 ms |
6272 KB |
wrong parameter |
16 |
Incorrect |
49 ms |
7252 KB |
wrong parameter |
17 |
Incorrect |
46 ms |
7040 KB |
wrong parameter |
18 |
Incorrect |
71 ms |
7656 KB |
wrong parameter |
19 |
Incorrect |
54 ms |
7432 KB |
wrong parameter |
20 |
Incorrect |
76 ms |
8368 KB |
wrong parameter |
21 |
Incorrect |
93 ms |
8420 KB |
wrong parameter |
22 |
Incorrect |
78 ms |
8448 KB |
wrong parameter |
23 |
Incorrect |
97 ms |
9204 KB |
wrong parameter |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
247 ms |
14576 KB |
wrong parameter |
2 |
Incorrect |
11 ms |
4744 KB |
wrong parameter |
3 |
Incorrect |
28 ms |
6408 KB |
wrong parameter |
4 |
Incorrect |
10 ms |
4756 KB |
wrong parameter |
5 |
Incorrect |
40 ms |
7296 KB |
wrong parameter |
6 |
Incorrect |
41 ms |
7444 KB |
wrong parameter |
7 |
Incorrect |
75 ms |
8452 KB |
wrong parameter |
8 |
Incorrect |
24 ms |
6144 KB |
wrong parameter |
9 |
Incorrect |
24 ms |
6272 KB |
wrong parameter |
10 |
Incorrect |
25 ms |
6408 KB |
wrong parameter |
11 |
Incorrect |
33 ms |
6704 KB |
wrong parameter |
12 |
Incorrect |
22 ms |
6144 KB |
wrong parameter |
13 |
Incorrect |
66 ms |
8368 KB |
wrong parameter |
14 |
Incorrect |
25 ms |
6372 KB |
wrong parameter |
15 |
Incorrect |
25 ms |
6272 KB |
wrong parameter |
16 |
Incorrect |
49 ms |
7252 KB |
wrong parameter |
17 |
Incorrect |
46 ms |
7040 KB |
wrong parameter |
18 |
Incorrect |
71 ms |
7656 KB |
wrong parameter |
19 |
Incorrect |
54 ms |
7432 KB |
wrong parameter |
20 |
Incorrect |
76 ms |
8368 KB |
wrong parameter |
21 |
Incorrect |
93 ms |
8420 KB |
wrong parameter |
22 |
Incorrect |
78 ms |
8448 KB |
wrong parameter |
23 |
Incorrect |
97 ms |
9204 KB |
wrong parameter |