Submission #557553

# Submission time Handle Problem Language Result Execution time Memory
557553 2022-05-05T13:03:56 Z timreizin Parachute rings (IOI12_rings) C++17
Compilation error
0 ms 0 KB
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

#define inbuf_len 1 << 16
#define outbuf_len 1 << 16

void Init(int N);
int CountCritical();
void Link(int a, int b);

int main() {
    //freopen("/Users/timreizin/Downloads/ioi2012tests/day1/rings/input/input3.txt", "r", stdin);
  int tmp;

  /* Set input and output buffering */
  char *inbuf, *outbuf;
  inbuf = (char*) malloc(inbuf_len * sizeof(char));
  outbuf = (char*) malloc(outbuf_len * sizeof(char));
  tmp = setvbuf(stdin, inbuf, _IOFBF, inbuf_len);
  tmp = setvbuf(stdout, outbuf, _IOFBF, outbuf_len);

  int N, L;
  tmp = scanf("%d %d", &N, &L);
  assert(tmp == 2);
  Init(N);

  int i;
  for (i = 0; i < L; i++) {
    int A, B;
    tmp = scanf("%d", &A);
    if (A == -1) {
      int critical;
      critical = CountCritical();
      printf("%d\n", critical);
    } else {
      tmp = scanf("%d", &B);
      assert(tmp == 1);
      Link(A, B);
    }
  }

  return 0;

}

Compilation message

/usr/bin/ld: /tmp/ccNfaisY.o: in function `main':
rings.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc3ivmYW.o:grader.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc3ivmYW.o: in function `main':
grader.cpp:(.text.startup+0x88): undefined reference to `Init(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0xca): undefined reference to `Link(int, int)'
/usr/bin/ld: grader.cpp:(.text.startup+0xed): undefined reference to `CountCritical()'
/usr/bin/ld: /tmp/ccNfaisY.o: in function `main':
rings.cpp:(.text.startup+0x88): undefined reference to `Init(int)'
/usr/bin/ld: rings.cpp:(.text.startup+0xca): undefined reference to `Link(int, int)'
/usr/bin/ld: rings.cpp:(.text.startup+0xed): undefined reference to `CountCritical()'
collect2: error: ld returned 1 exit status