Submission #336657

#TimeUsernameProblemLanguageResultExecution timeMemory
336657JoshcQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++11
Compilation error
0 ms0 KiB
#include <vector> #include <algorithm> using namespace std; vector<int> ans[921]; void init() { if (ans[1].empty()) { int cur = 0; for (int i=1; i<=7; i++) { for (int j=i+1; j<=8; j++) { for (int k=j+1; k<=9; k++) { for (int l=k+1; l<=10; l++) { for (int m=l+1; m<=11; m++) { for (int n=m+1; n<=12; n++) ans[++cur] = {i, j, k, l, m, n}; } } } } } } } int createAdvice(int x, int y, int correct) { init(); if (correct == y) swap(x, y); for (int i : ans[x]) { if (find(ans[y].begin(), ans[y].end(), i) == ans[y].end()) return i; } }
#include <vector> #include <algorithm> using namespace std; vector<int> ans[921]; void init() { if (ans[1].empty()) { int cur = 0; for (int i=1; i<=7; i++) { for (int j=i+1; j<=8; j++) { for (int k=j+1; k<=9; k++) { for (int l=k+1; l<=10; l++) { for (int m=l+1; m<=11; m++) { for (int n=m+1; n<=12; n++) ans[++cur] = {i, j, k, l, m, n}; } } } } } } } bool receiveAdvice(int q, int h) { init() return find(ans[q].begin(), ans[q].end(), h) != ans[q].end(); }

Compilation message (stderr)

encoder.cpp: In function 'int createAdvice(int, int, int)':
encoder.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^
/tmp/ccoBK83P.o: In function `main':
grader_encode.c:(.text.startup+0x129): undefined reference to `encode(int, int, int)'
collect2: error: ld returned 1 exit status

decoder.cpp: In function 'bool receiveAdvice(int, int)':
decoder.cpp:25:11: error: expected ';' before 'return'
   25 |     init()
      |           ^
      |           ;
   26 |     return find(ans[q].begin(), ans[q].end(), h) != ans[q].end();
      |     ~~~~~~ 
decoder.cpp:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^