Submission #1064091

#TimeUsernameProblemLanguageResultExecution timeMemory
1064091VMaksimoski008Friend (IOI14_friend)C++17
27 / 100
20 ms1368 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int mat[10][10]; int findSample(int n, int confidence[], int host[], int protocol[]) { int ans=0; if(n <= 10) { for(int i=1; i<n; i++) { if(protocol[i] == 0) { mat[host[i]][i] = mat[i][host[i]] = 1; } else if(protocol[i] == 1) { for(int j=0; j<n; j++) if(mat[host[i]][j]) mat[i][j] = mat[j][i] = 1; } else { mat[host[i]][i] = mat[i][host[i]] = 1; for(int j=0; j<n; j++) if(mat[host[i]][j]) mat[i][j] = mat[j][i] = 1; } } for(int s=0; s<(1<<n); s++) { bool ok = 1; vector<int> vec; for(int i=0; i<n; i++) { if(s & (1 << i)) { for(int &x : vec) if(mat[x][i]) ok = 0; vec.push_back(i); } } if(ok) { int sum = 0; for(int &x : vec) sum += confidence[x]; ans = max(ans, sum); } } return ans; } set<int> st; for(int i=1; i<n; i++) st.insert(protocol[i]); if(st.size() == 1 && *st.begin() == 1) { for(int i=0; i<n; i++) ans += confidence[i]; return ans; } if(st.size() == 1 && *st.begin() == 2) { for(int i=0; i<n; i++) ans = max(ans, confidence[i]); return ans; } return ans; }
#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...