Submission #798261

#TimeUsernameProblemLanguageResultExecution timeMemory
798261QwertyPi친구 (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; struct state{ int p, q; }; state st[100011]; state f(int ptc, state s, state t){ if(ptc == 1) return {s.p + t.q, max(s.q + t.p, s.q + t.q)}; else if(ptc == 2) return {max(s.p + t.p, max(s.p + t.q, s.q + t.p)), s.q + t.q}; else return {max(s.p + t.q, s.q + t.p), s.q + t.q}; } int findSample(int n, int confidence[], int host[], int protocol[]){ for(int i = 0; i < n; i++) st[i] = {confidence[i], 0}; for(int i = n - 1; i >= 1; i--){ st[host[i]] = f(protocol[i], st[i], st[host[i]]); } return ans; }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:22:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   22 |  return ans;
      |         ^~~
      |         abs