Submission #50888

#TimeUsernameProblemLanguageResultExecution timeMemory
50888TalantFriend (IOI14_friend)C++17
27 / 100
61 ms25328 KiB
#include "friend.h" #include <bits/stdc++.h> #define pb push_back #define mk make_pair #define sc second #define fr first using namespace std; const int N = (1e6 + 5); int u[1005][1005]; int ans; int fg; vector <int> g[N]; int findSample(int n,int confidence[],int host[],int protocol[]){ if (n <= 10) { for (int i = 1; i < n; i ++) { int v = host[i]; if (protocol[i] == 0) { u[v][i] = 1,u[i][v] = 1; g[v].pb(i),g[i].pb(v); } else if (protocol[i] == 1) { for (auto to : g[v]) { g[to].pb(i),g[i].pb(to); u[to][i] = 1,u[i][to] = 1; } } else { for (auto to : g[v]) { g[to].pb(i),g[i].pb(to); u[to][i] = 1,u[i][to] = 1; } g[v].pb(i); g[i].pb(v); u[v][i] = 1; u[i][v] = 1; } } for (int i = 0; i < (1 << n); i ++) { vector <int> v; int fl = 0; int as = 0; for (int j = 0; j < n; j ++) { if (i & (1 << j)) { for (auto to : v) if (u[to][j]) fl = 1; as += confidence[j]; v.pb(j); } } if (!fl) ans = max(ans,as); } return ans; } else { if (protocol[1] == 1) { for (int i = 0; i < n; i ++) ans += confidence[i]; return ans; } else if (protocol[1] == 2) { for (int i = 0; i < n; i ++) ans = max(ans,confidence[i]); return ans; } else { } } }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...