Submission #647906

#TimeUsernameProblemLanguageResultExecution timeMemory
647906khshgCats or Dogs (JOI18_catdog)C++14
Compilation error
0 ms0 KiB
return min(dp[0][0], dp[0][1]); } int neighbor(int v) { --v; oc[v][0] = oc[v][1] = false; dfs(0, -1); return min(dp[0][0], dp[0][1]); } /* int readInt(){ int i; if(scanf("%d",&i)!=1){ fprintf(stderr,"Error while reading input\n"); exit(1); } return i; } int main(){ int N=readInt(); std::vector<int> A(N-1),B(N-1); for(int i=0;i<N-1;i++) { A[i]=readInt(); B[i]=readInt(); } int Q; assert(scanf("%d",&Q)==1); std::vector <int> T(Q),V(Q); for(int i=0;i<Q;i++) { T[i]=readInt(); V[i]=readInt(); } initialize(N,A,B); std::vector<int> res(Q); for(int j=0;j<Q;j++) { if(T[j]==1) res[j]=cat(V[j]); else if(T[j]==2) res[j]=dog(V[j]); else res[j]=neighbor(V[j]); } for(int j=0;j<Q;j++) printf("%d\n",res[j]); return 0; }*/

Compilation message (stderr)

catdog.cpp:1:2: error: expected unqualified-id before 'return'
    1 |  return min(dp[0][0], dp[0][1]);
      |  ^~~~~~
catdog.cpp:2:1: error: expected declaration before '}' token
    2 | }
      | ^
catdog.cpp: In function 'int neighbor(int)':
catdog.cpp:6:2: error: 'oc' was not declared in this scope
    6 |  oc[v][0] = oc[v][1] = false;
      |  ^~
catdog.cpp:7:2: error: 'dfs' was not declared in this scope
    7 |  dfs(0, -1);
      |  ^~~
catdog.cpp:8:13: error: 'dp' was not declared in this scope
    8 |  return min(dp[0][0], dp[0][1]);
      |             ^~
catdog.cpp:8:9: error: 'min' was not declared in this scope
    8 |  return min(dp[0][0], dp[0][1]);
      |         ^~~