제출 #372868

#제출 시각아이디문제언어결과실행 시간메모리
372868apostoldaniel854Memory (IOI10_memory)C++14
컴파일 에러
0 ms0 KiB
//#define HOME #include <bits/stdc++.h> #ifndef HOME #include "memory.h" #include "grader.h" #endif // HOME #ifdef HOME static char card[51]; static int up[2], is_up[51], candy[25], candies, moves; char faceup(int C){ int c0, c1; if (C < 1 || C > 50 || is_up[C]) { exit(92); } is_up[C] = 1; up[moves%2] = C; moves++; if (moves%2 == 0) { c0 = card[ up[0] ] - 'A'; c1 = card[ up[1] ] - 'A'; if (c0==c1 && !candy[c0]) { candy[c0] = 1; ++candies; } is_up[ up[0] ] = is_up[ up[1] ] = 0; } return card[C]; } #endif // HOME const int MAX_N = 50; int cached_card[1 + MAX_N]; std::vector <int> pos[1 + MAX_N]; #define pb push_back void play() { for (int i = 0; i <= MAX_N; i++) pos[i].clear (), cached_card[i] = 0; for (int i = 1; i <= MAX_N; i += 2) { cached_card[i] = faceup (i) - 'A'; cached_card[i + 1] = faceup (i + 1) - 'A'; if (cached_card[i] != cached_card[i + 1]) { pos[cached_card[i]].pb (i); pos[cached_card[i + 1]].pb (i + 1); } } for (int i = 0; i <= MAX_N; i++) if (pos[i].size () == 2) { faceup (pos[i][0]); faceup (pos[i][1]); } } #ifdef HOME void playgame(){ int i; for (i=1;i<=50;i++) { // card[i] = getchar(); card[i] = rand () % 25 + 'A'; } moves = candies = 0; play(); if (candies != 25) { exit(91); } } #endif // HOME int main(){ playgame(); printf("OK %d\n",moves); return 0; }

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

memory.cpp: In function 'int main()':
memory.cpp:73:4: error: 'playgame' was not declared in this scope
   73 |    playgame();
      |    ^~~~~~~~
memory.cpp:74:21: error: 'moves' was not declared in this scope
   74 |    printf("OK %d\n",moves);
      |                     ^~~~~