Submission #704567

#TimeUsernameProblemLanguageResultExecution timeMemory
704567jamezzzFriend (IOI14_friend)C++17
Compilation error
0 ms0 KiB
#include "friend.h"
#incldue <bits/stdc++.h>
using namespace std;

#define maxn 100005
int take[maxn],notake[maxn];

// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
	for(int i=0;i<n;++i)take[i]=confidence[i];
	for(int i=n-1;i>0;--i){
		int h=host[i];
		if(protocol[i]==0){//i am your friend
			take[h]+=notake[i];
			notake[h]+=max(take[i],notake[i]);
		}
		else if(protocol[i]==1){//my friends are your friends
			take[h]=max(take[h]+take[i],max(take[h]+notake[i],notake[h]+take[i]));
			notake[h]+=notake[i];
		}
		else{//we are your friends
			take[h]=max(take[h]+notake[i],notake[h]+take[i]);
			notake[h]+=notake[i];
		}
	}
	return max(take[0],notake[0]);;
}

Compilation message (stderr)

friend.cpp:2:2: error: invalid preprocessing directive #incldue; did you mean #include?
    2 | #incldue <bits/stdc++.h>
      |  ^~~~~~~
      |  include
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:15:15: error: 'max' was not declared in this scope; did you mean 'maxn'?
   15 |    notake[h]+=max(take[i],notake[i]);
      |               ^~~
      |               maxn
friend.cpp:18:32: error: 'max' was not declared in this scope; did you mean 'maxn'?
   18 |    take[h]=max(take[h]+take[i],max(take[h]+notake[i],notake[h]+take[i]));
      |                                ^~~
      |                                maxn
friend.cpp:18:12: error: 'max' was not declared in this scope; did you mean 'maxn'?
   18 |    take[h]=max(take[h]+take[i],max(take[h]+notake[i],notake[h]+take[i]));
      |            ^~~
      |            maxn
friend.cpp:22:12: error: 'max' was not declared in this scope; did you mean 'maxn'?
   22 |    take[h]=max(take[h]+notake[i],notake[h]+take[i]);
      |            ^~~
      |            maxn
friend.cpp:26:9: error: 'max' was not declared in this scope; did you mean 'maxn'?
   26 |  return max(take[0],notake[0]);;
      |         ^~~
      |         maxn