답안 #565087

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
565087 2022-05-20T08:54:52 Z Uzouf 저장 (Saveit) (IOI10_saveit) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
#include "encoder.h"
 
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]=2000;
    }
    grid[i][i]=0;
  }
  for (int i=0;i<p;i++) {
    grid[a[i]][b[i]]=1;
    grid[b[i]][a[i]]=1;
  }
 
  for (int k=0;k<N;k++) 
    for (int i=0;i<N;i++) {
      for (int j=0;j<N;j++) {
        int tmp=grid[i][k]+grid[k][j];
        if (i!=j && grid[i][j]>tmp) grid[i][j]=tmp;
      }
    }
 
  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)==0) encode_bit(0);
        else encode_bit(1);
      }
    }
  }
}
#include <bits/stdc++.h>
using namespace std;
#include "grader.h"
#include "encoder.h"
#define int long long
const int N=1000+5;

void decode(int n,int h) {
  for (int i=0;i<h;i++) {
    for (int j=0;j<n;j++) {
      int nm=0;
      for (int p=0;p<10;p++) {
        nm+=((1<<p)*decode_bit());
      }
      hops(i,j,nm);
    }
  }
  
}

Compilation message

encoder.cpp: In function 'void encode(int, int, int, int*, int*)':
encoder.cpp:7:12: error: 'N' was not declared in this scope
    7 |   int grid[N][N];
      |            ^
encoder.cpp:10:9: error: 'grid' was not declared in this scope
   10 |         grid[i][j]=2000;
      |         ^~~~
encoder.cpp:12:5: error: 'grid' was not declared in this scope
   12 |     grid[i][i]=0;
      |     ^~~~
encoder.cpp:15:5: error: 'grid' was not declared in this scope
   15 |     grid[a[i]][b[i]]=1;
      |     ^~~~
encoder.cpp:22:17: error: 'grid' was not declared in this scope
   22 |         int tmp=grid[i][k]+grid[k][j];
      |                 ^~~~
encoder.cpp:29:14: error: 'grid' was not declared in this scope
   29 |       int nm=grid[i][j];
      |              ^~~~

/usr/bin/ld: /tmp/ccXknB5w.o: in function `main':
grader_decoder.c:(.text.startup+0x126): undefined reference to `decode(int, int)'
collect2: error: ld returned 1 exit status