Submission #1017314

#TimeUsernameProblemLanguageResultExecution timeMemory
1017314vivkostovFriend (IOI14_friend)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define endl '\n' #include "friend.h" using namespace std; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n,a,b,br[15][15],mas[15],otg,con[15]; void check() { int seg=0; for(int i=1;i<=n;i++) { if(!mas[i])continue; for(int j=i+1;j<=n;j++) { if(!mas[j])continue; if(br[i][j])return; } seg+=con[i]; } otg=max(otg,seg); } void rec(int step) { if(step==n) { check(); return; } for(int i=0;i<=1;i++) { mas[step+1]=i; rec(step+1); mas[step+1]=0; } } int findSample(int N, int confidence[], int host[], int protocol[]) { n=N; for(int i=1;i<=n;i++) { if(protocol[i]==0) { br[host[i]][i]=1; br[i][host[i]]=1; } if(protocol[i]==1) { for(int j=1;j<=n;j++) { br[i][j]=br[host[i]][i]; br[j][i]=br[i][host[i]]; } } if(protocol[i]==2) { for(int j=1;j<=n;j++) { br[i][j]=br[host[i]][i]; br[j][i]=br[i][host[i]]; } br[host[i]][i]=1; br[i][host[i]]=1; } } for(int i=1;i<=n;i++) { con[i]=confidence[i-1]; } rec(0); return otg; } void read() { cin>>n; for(int i=1;i<=n;i++) { cin>>ho[i]>>pr[i]; if(protocol[i]==0) { br[a][i]=1; br[i][a]=1; } if(pr[i]==1) { for(int i=1;i<=n;i++) { br[b][i]=br[a][i]; br[i][b]=br[i][a]; } } if(pr[i]==2) { for(int i=1;i<=n;i++) { br[b][i]=br[a][i]; br[i][b]=br[i][a]; } br[a][i]=1; br[i][a]=1; } } } /*int main() { speed(); read(); return 0; } */

Compilation message (stderr)

friend.cpp: In function 'void read()':
friend.cpp:82:14: error: 'ho' was not declared in this scope
   82 |         cin>>ho[i]>>pr[i];
      |              ^~
friend.cpp:82:21: error: 'pr' was not declared in this scope; did you mean 'br'?
   82 |         cin>>ho[i]>>pr[i];
      |                     ^~
      |                     br
friend.cpp:83:12: error: 'protocol' was not declared in this scope
   83 |         if(protocol[i]==0)
      |            ^~~~~~~~