제출 #1238052

#제출 시각아이디문제언어결과실행 시간메모리
1238052ema_nicoleCluedo (IOI10_cluedo)C++17
컴파일 에러
0 ms0 KiB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "grader.h"
#include "cluedo.h"

static int M,L,W,gotit,cnt,maxcnt;

int Theory(int m, int l, int w) {
   ++cnt;
   if (m < 1 || m > 6 || l < 1 || l > 10 || w < 1 || w > 6) exit(92);
   if (rand()%2 && m != M) return 1;
   else if (rand()%2 && l != L) return 2;
   else if (rand()%2 && w != W) return 3;
   else if (m != M) return 1;
   else if (l != L) return 2;
   else if (w != W) return 3;
   gotit = 1;
   return 0;
}

void Solve() {
    int om = 1, room = 1, weapon = 1;
    while(1) {
        int nr = Theory(om, room, weapon);
        //cout << om << " " << room << " " << weapon << "  " << nr << '\n';
        if(!nr)
            return;
        if(nr == 1) ///om gresit
            om++;
        else if(nr == 2) ///camera gresita
            room++;
        else if(nr == 3) ///weapon gresit
            weapon++;
    }
}

int main(){
   while (3 == scanf("%d%d%d",&M,&L,&W)) {
      cnt = gotit = 0;
      Solve();
      if (cnt > maxcnt) maxcnt = cnt;
      if (!gotit) {
         printf("NO\n");
         return 91;
      }
   }
   printf("OK %d\n",maxcnt);
   return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/cce7hexW.o: in function `Theory(int, int, int)':
grader.c:(.text+0x0): multiple definition of `Theory(int, int, int)'; /tmp/ccb2iHTY.o:cluedo.cpp:(.text+0x0): first defined here
/usr/bin/ld: /tmp/cce7hexW.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccb2iHTY.o:cluedo.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status