# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
565048 |
2022-05-20T08:18:04 Z |
Uzouf |
Saveit (IOI10_saveit) |
C++14 |
|
0 ms |
0 KB |
#include <bits/stdc++.h>
using namespace std;
void encode(int n,int h,int p,int a[],int b[]) {
int grid[n][n];
for (int i=0;i<n;i++) {
for (int j=0;j<n;j++) {
grid[i][j]=1e9;
}
grid[i][i]=0;
}
for (int i=0;i<p;i++) {
grid[a[i]][b[i]]=1;
grid[b[i]][a[i]]=1;
grid[i][i]=0;
}
for (int k=0;k<n;k++)
for (int i=0;i<n;i++) {
for (int j=0;j<n;j++) {
grid[i][j]=min(grid[i][j],grid[i][k]+grid[k][j]);
}
}
}
for (int i=0;i<h;i++) {
for (int j=0;j<n;j++) {
int nm=grid[i][j];
for (int pp=0;pp<10;pp++) {
if (((1<<pp)&nm)==(1<<pp)) encode_bit(1);
else encode_bit(0);
}
}
}
}
#include <bits/stdc++.h>
using namespace std;
void decode(int n,int h) {
for (int i=0;i<h;i++) {
for (int j=0;j<n;j++) {
int nm=0,t=0;
while (t<10) {
if (decode_bit()==1) nm+=(1<<t);
t++;
}
hops(i,j,nm);
}
}
}
Compilation message
encoder.cpp:26:3: error: expected unqualified-id before 'for'
26 | for (int i=0;i<h;i++) {
| ^~~
encoder.cpp:26:16: error: 'i' does not name a type
26 | for (int i=0;i<h;i++) {
| ^
encoder.cpp:26:20: error: 'i' does not name a type
26 | for (int i=0;i<h;i++) {
| ^
encoder.cpp:35:1: error: expected declaration before '}' token
35 | }
| ^
decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:9:11: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
9 | if (decode_bit()==1) nm+=(1<<t);
| ^~~~~~~~~~
| decode
decoder.cpp:12:7: error: 'hops' was not declared in this scope
12 | hops(i,j,nm);
| ^~~~