#include "grader.h"
#include "encoder.h"
#include<bits/stdc++.h>
#define ll long long
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define endl '\n'
#define pb push_back
using namespace std ;
//fflush(stdout) ;
const int MAX_N=1e3+5 ;
vector<int>v[MAX_N] ;
int des[1004][1004] ;
void dfs(int x, int p , int s){
for(int i:v[x]){
if(i!=p&&(des[s][i]==-1||des[s][i]>(des[s][x]+1))){
des[s][i]=(des[s][x]+1) ;
dfs(i,x,s) ;
}
}
}
void encode(int nv, int nh, int ne, int *v1, int *v2){
encode_bit(1);
encode_bit(0);
for(int i=0 ; i<ne ; i++){
v[v1[i]].push_back(v2[i]) ;
v[v2[i]].push_back(v1[i]) ;
}
for(int i=0 ; i<nv ; i++){
for(int j=0 ; j<nv ; j++){
des[i][j]=-1 ;
if(i==j) des[i][j]=0 ;
}
dfs(i,0,i) ;
}
for(int i=0 ; i<nv ; i++){
for(int j=0 ; j<nh ; j++){
while(des[i][j]--){
encode_bit(1) ;
}
encode_bit(0);
}
}
}
#include "grader.h"
#include "decoder.h"
#include<bits/stdc++.h>
#define ll long long
#define no cout << "NO\n"
#define yes cout << "YES\n"
#define endl '\n'
#define pb push_back
using namespace std ;
//fflush(stdout) ;
void decode(int nv, int nh) {
for(int i=0 ; i<nv ; i++){
for(int j=0 ; j<nh ; j++){
int x , r=0 ;
x=decode_bit() ;
while(x==1){
r++ ;
x=decode_bit() ;
}
hops(j,i,r);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10074 ms |
5660 KB |
Time limit exceeded |
2 |
Incorrect |
2 ms |
4528 KB |
Output isn't correct |
3 |
Execution timed out |
10092 ms |
3848 KB |
Time limit exceeded |
4 |
Incorrect |
2 ms |
4616 KB |
Output isn't correct |
5 |
Execution timed out |
10079 ms |
2780 KB |
Time limit exceeded |
6 |
Execution timed out |
10096 ms |
2396 KB |
Time limit exceeded |
7 |
Execution timed out |
10088 ms |
1952 KB |
Time limit exceeded |
8 |
Incorrect |
2404 ms |
14232 KB |
Output isn't correct |
9 |
Incorrect |
1214 ms |
67468 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
1684 ms |
32356 KB |
Output isn't correct |
11 |
Incorrect |
3986 ms |
67548 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
96 ms |
67364 KB |
too many calls to encode_bit(b) function |
13 |
Execution timed out |
10072 ms |
2148 KB |
Time limit exceeded |
14 |
Incorrect |
2132 ms |
67312 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
3355 ms |
60276 KB |
Output isn't correct |
16 |
Execution timed out |
10091 ms |
4008 KB |
Time limit exceeded |
17 |
Execution timed out |
10063 ms |
4064 KB |
Time limit exceeded |
18 |
Execution timed out |
10033 ms |
2748 KB |
Time limit exceeded |
19 |
Execution timed out |
10012 ms |
3352 KB |
Time limit exceeded |
20 |
Execution timed out |
10093 ms |
2632 KB |
Time limit exceeded |
21 |
Execution timed out |
10093 ms |
2916 KB |
Time limit exceeded |
22 |
Execution timed out |
10092 ms |
2340 KB |
Time limit exceeded |
23 |
Execution timed out |
10059 ms |
2704 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10074 ms |
5660 KB |
Time limit exceeded |
2 |
Incorrect |
2 ms |
4528 KB |
Output isn't correct |
3 |
Execution timed out |
10092 ms |
3848 KB |
Time limit exceeded |
4 |
Incorrect |
2 ms |
4616 KB |
Output isn't correct |
5 |
Execution timed out |
10079 ms |
2780 KB |
Time limit exceeded |
6 |
Execution timed out |
10096 ms |
2396 KB |
Time limit exceeded |
7 |
Execution timed out |
10088 ms |
1952 KB |
Time limit exceeded |
8 |
Incorrect |
2404 ms |
14232 KB |
Output isn't correct |
9 |
Incorrect |
1214 ms |
67468 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
1684 ms |
32356 KB |
Output isn't correct |
11 |
Incorrect |
3986 ms |
67548 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
96 ms |
67364 KB |
too many calls to encode_bit(b) function |
13 |
Execution timed out |
10072 ms |
2148 KB |
Time limit exceeded |
14 |
Incorrect |
2132 ms |
67312 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
3355 ms |
60276 KB |
Output isn't correct |
16 |
Execution timed out |
10091 ms |
4008 KB |
Time limit exceeded |
17 |
Execution timed out |
10063 ms |
4064 KB |
Time limit exceeded |
18 |
Execution timed out |
10033 ms |
2748 KB |
Time limit exceeded |
19 |
Execution timed out |
10012 ms |
3352 KB |
Time limit exceeded |
20 |
Execution timed out |
10093 ms |
2632 KB |
Time limit exceeded |
21 |
Execution timed out |
10093 ms |
2916 KB |
Time limit exceeded |
22 |
Execution timed out |
10092 ms |
2340 KB |
Time limit exceeded |
23 |
Execution timed out |
10059 ms |
2704 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10074 ms |
5660 KB |
Time limit exceeded |
2 |
Incorrect |
2 ms |
4528 KB |
Output isn't correct |
3 |
Execution timed out |
10092 ms |
3848 KB |
Time limit exceeded |
4 |
Incorrect |
2 ms |
4616 KB |
Output isn't correct |
5 |
Execution timed out |
10079 ms |
2780 KB |
Time limit exceeded |
6 |
Execution timed out |
10096 ms |
2396 KB |
Time limit exceeded |
7 |
Execution timed out |
10088 ms |
1952 KB |
Time limit exceeded |
8 |
Incorrect |
2404 ms |
14232 KB |
Output isn't correct |
9 |
Incorrect |
1214 ms |
67468 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
1684 ms |
32356 KB |
Output isn't correct |
11 |
Incorrect |
3986 ms |
67548 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
96 ms |
67364 KB |
too many calls to encode_bit(b) function |
13 |
Execution timed out |
10072 ms |
2148 KB |
Time limit exceeded |
14 |
Incorrect |
2132 ms |
67312 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
3355 ms |
60276 KB |
Output isn't correct |
16 |
Execution timed out |
10091 ms |
4008 KB |
Time limit exceeded |
17 |
Execution timed out |
10063 ms |
4064 KB |
Time limit exceeded |
18 |
Execution timed out |
10033 ms |
2748 KB |
Time limit exceeded |
19 |
Execution timed out |
10012 ms |
3352 KB |
Time limit exceeded |
20 |
Execution timed out |
10093 ms |
2632 KB |
Time limit exceeded |
21 |
Execution timed out |
10093 ms |
2916 KB |
Time limit exceeded |
22 |
Execution timed out |
10092 ms |
2340 KB |
Time limit exceeded |
23 |
Execution timed out |
10059 ms |
2704 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
10074 ms |
5660 KB |
Time limit exceeded |
2 |
Incorrect |
2 ms |
4528 KB |
Output isn't correct |
3 |
Execution timed out |
10092 ms |
3848 KB |
Time limit exceeded |
4 |
Incorrect |
2 ms |
4616 KB |
Output isn't correct |
5 |
Execution timed out |
10079 ms |
2780 KB |
Time limit exceeded |
6 |
Execution timed out |
10096 ms |
2396 KB |
Time limit exceeded |
7 |
Execution timed out |
10088 ms |
1952 KB |
Time limit exceeded |
8 |
Incorrect |
2404 ms |
14232 KB |
Output isn't correct |
9 |
Incorrect |
1214 ms |
67468 KB |
too many calls to encode_bit(b) function |
10 |
Incorrect |
1684 ms |
32356 KB |
Output isn't correct |
11 |
Incorrect |
3986 ms |
67548 KB |
too many calls to encode_bit(b) function |
12 |
Incorrect |
96 ms |
67364 KB |
too many calls to encode_bit(b) function |
13 |
Execution timed out |
10072 ms |
2148 KB |
Time limit exceeded |
14 |
Incorrect |
2132 ms |
67312 KB |
too many calls to encode_bit(b) function |
15 |
Incorrect |
3355 ms |
60276 KB |
Output isn't correct |
16 |
Execution timed out |
10091 ms |
4008 KB |
Time limit exceeded |
17 |
Execution timed out |
10063 ms |
4064 KB |
Time limit exceeded |
18 |
Execution timed out |
10033 ms |
2748 KB |
Time limit exceeded |
19 |
Execution timed out |
10012 ms |
3352 KB |
Time limit exceeded |
20 |
Execution timed out |
10093 ms |
2632 KB |
Time limit exceeded |
21 |
Execution timed out |
10093 ms |
2916 KB |
Time limit exceeded |
22 |
Execution timed out |
10092 ms |
2340 KB |
Time limit exceeded |
23 |
Execution timed out |
10059 ms |
2704 KB |
Time limit exceeded |