답안 #817033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
817033 2023-08-09T08:43:50 Z 이종영(#10379) 게임 (APIO22_game) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "game.h"

namespace {

int read_int() {
  int x;
  if (scanf("%d", &x) != 1) {
    fprintf(stderr, "Error while reading input\n");
    exit(1);
  }
  return x;
}

}  // namespace

int main() {
  freopen("output.txt","r",stdin);
  int N = read_int();
  int M = read_int();
  int K = read_int();
  std::vector<int> u(M), v(M);
  for (int i = 0; i < M; ++i) {
    u[i] = read_int();
    v[i] = read_int();
  }

  init(N, K);
  printf("%d\n",(int)clock());
  int i;
  for (i = 0; i < M; ++i) {
    int answer = add_teleporter(u[i], v[i]);
    if (answer != 0 && answer != 1) {
      i = -1;
      break;
    } else if (answer == 1) {
      break;
    }
    if(i%10000==0) printf("%d %d\n",i,(int)clock());
  }
  printf("%d\n", i);
  printf("%d",(int)clock());
  return 0;
}

Compilation message

game.cpp: In function 'int main()':
game.cpp:18:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   freopen("output.txt","r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccxoEJpy.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cck3hIgw.o:game.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cck3hIgw.o: in function `main':
game.cpp:(.text.startup+0x106): undefined reference to `init(int, int)'
/usr/bin/ld: game.cpp:(.text.startup+0x163): undefined reference to `add_teleporter(int, int)'
/usr/bin/ld: /tmp/ccxoEJpy.o: in function `main':
stub.cpp:(.text.startup+0x64): undefined reference to `init(int, int)'
/usr/bin/ld: stub.cpp:(.text.startup+0xda): undefined reference to `add_teleporter(int, int)'
collect2: error: ld returned 1 exit status