답안 #565157

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565157 2022-05-20T11:04:43 Z katwamiaw 저장 (Saveit) (IOI10_saveit) C++14
컴파일 오류
0 ms 0 KB
#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) ;

contst int MAX_N=1e3+5 ;
vector<int>v[MAX_N] ;
int des[1004][1004] ;

int 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);
      }
  }
}
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);
       }
   }
}

Compilation message

encoder.cpp:10:1: error: 'contst' does not name a type
   10 | contst int MAX_N=1e3+5 ;
      | ^~~~~~
encoder.cpp:11:14: error: 'MAX_N' was not declared in this scope
   11 | vector<int>v[MAX_N] ;
      |              ^~~~~
encoder.cpp: In function 'int dfs(int, int, int)':
encoder.cpp:15:15: error: 'v' was not declared in this scope
   15 |     for(int i:v[x]){
      |               ^
encoder.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
   21 | }
      | ^
encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:24:3: error: 'encode_bit' was not declared in this scope; did you mean 'encode'?
   24 |   encode_bit(1);
      |   ^~~~~~~~~~
      |   encode
encoder.cpp:27:7: error: 'v' was not declared in this scope
   27 |       v[v1[i]].push_back(v2[i]) ;
      |       ^

decoder.cpp: In function 'void decode(int, int)':
decoder.cpp:5:15: error: 'decode_bit' was not declared in this scope; did you mean 'decode'?
    5 |            x==decode_bit() ;
      |               ^~~~~~~~~~
      |               decode
decoder.cpp:10:13: error: 'hops' was not declared in this scope
   10 |             hops(j,i,r);
      |             ^~~~