Submission #798260

#TimeUsernameProblemLanguageResultExecution timeMemory
798260QwertyPiFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include "friend.h" 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 'state f(int, state, state)':
friend.cpp:10:34: error: 'max' was not declared in this scope
   10 |  if(ptc == 1) return {s.p + t.q, max(s.q + t.p, s.q + t.q)};
      |                                  ^~~
friend.cpp:10:59: error: could not convert '{(s.state::p + t.state::q), <expression error>}' from '<brace-enclosed initializer list>' to 'state'
   10 |  if(ptc == 1) return {s.p + t.q, max(s.q + t.p, s.q + t.q)};
      |                                                           ^
      |                                                           |
      |                                                           <brace-enclosed initializer list>
friend.cpp:11:43: error: 'max' was not declared in this scope
   11 |  else if(ptc == 2) return {max(s.p + t.p, max(s.p + t.q, s.q + t.p)), s.q + t.q};
      |                                           ^~~
friend.cpp:11:28: error: 'max' was not declared in this scope
   11 |  else if(ptc == 2) return {max(s.p + t.p, max(s.p + t.q, s.q + t.p)), s.q + t.q};
      |                            ^~~
friend.cpp:11:80: error: could not convert '{<expression error>, (s.state::q + t.state::q)}' from '<brace-enclosed initializer list>' to 'state'
   11 |  else if(ptc == 2) return {max(s.p + t.p, max(s.p + t.q, s.q + t.p)), s.q + t.q};
      |                                                                                ^
      |                                                                                |
      |                                                                                <brace-enclosed initializer list>
friend.cpp:12:15: error: 'max' was not declared in this scope
   12 |  else return {max(s.p + t.q, s.q + t.p), s.q + t.q};
      |               ^~~
friend.cpp:12:51: error: could not convert '{<expression error>, (s.state::q + t.state::q)}' from '<brace-enclosed initializer list>' to 'state'
   12 |  else return {max(s.p + t.q, s.q + t.p), s.q + t.q};
      |                                                   ^
      |                                                   |
      |                                                   <brace-enclosed initializer list>
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:20:9: error: 'ans' was not declared in this scope
   20 |  return ans;
      |         ^~~