QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#110057#2001. Tropical Gardenthenymphsofdelphi#Compile Error//C++201.3kb2023-05-31 12:56:552024-05-31 13:52:17

Judging History

你现在查看的是最新测评结果

  • [2024-05-31 13:52:17]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-31 12:56:55]
  • 提交

answer

#include "garden.h"
#include "gardenlib.h"
#include <stdio.h>
#include <stdlib.h>

#define MAX_M  1000000
#define MAX_Q  2000

static int N, M, P, Q;
static int R[MAX_M][2];
static int G[MAX_Q];
static int solutions[MAX_Q];
static int answers[MAX_Q];
static int answer_count;

inline 
void my_assert(int e) {if (!e) abort();}
void read_input()
{
  int i;
  my_assert(3==scanf("%d %d %d",&N,&M,&P));
  for(i=0; i<M; i++)
    my_assert(2==scanf("%d %d",&R[i][0],&R[i][1]));
  my_assert(1==scanf("%d",&Q));
  for(i=0; i<Q; i++)
    my_assert(1==scanf("%d",&G[i]));
  for(i=0; i<Q; i++)
    my_assert(1==scanf("%d",&solutions[i]));
}

void answer(int x)
{
  if(answer_count>=Q) {
    printf("Incorrect.  Too many answers.\n");
    exit(0);
  }
  answers[answer_count] = x;
  answer_count++;
}

int main()
{
  int correct, i;

  read_input();
  answer_count = 0;
  count_routes(N,M,P,R,Q,G);

  if(answer_count!=Q) {
    printf("Incorrect.  Too few answers.\n");
    exit(0);
  }

  correct = 1;
  for(i=0; i<Q; i++)
    if(answers[i]!=solutions[i])
      correct = 0;
  if(correct)
    printf("Correct.\n");
  else {
    printf("Incorrect.\n");
    printf("Expected: ");
    for(i=0; i<Q; i++)
      printf("%d ",solutions[i]);
    printf("\nReturned: ");
    for(i=0; i<Q; i++)
      printf("%d ",answers[i]);
  }
  return 0;
}

Details

/usr/bin/ld: /tmp/cc1yv2sX.o: in function `read_input()':
answer.code:(.text+0x0): multiple definition of `read_input()'; /tmp/cchq8LNW.o:implementer.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cc1yv2sX.o: in function `answer(int)':
answer.code:(.text+0x120): multiple definition of `answer(int)'; /tmp/cchq8LNW.o:implementer.cpp:(.text+0x120): first defined here
/usr/bin/ld: /tmp/cc1yv2sX.o: in function `main':
answer.code:(.text.startup+0x0): multiple definition of `main'; /tmp/cchq8LNW.o:implementer.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cchq8LNW.o: in function `main':
implementer.cpp:(.text.startup+0x45): undefined reference to `count_routes(int, int, int, int (*) [2], int, int*)'
/usr/bin/ld: /tmp/cc1yv2sX.o: in function `main':
answer.code:(.text.startup+0x45): undefined reference to `count_routes(int, int, int, int (*) [2], int, int*)'
collect2: error: ld returned 1 exit status