Submission #874088

#TimeUsernameProblemLanguageResultExecution timeMemory
874088FenixionFriend (IOI14_friend)C++14
16 / 100
11 ms12580 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; int findSample(int n, int confidence[], int host[], int protocol[]) { vector<vector<int>> adjlist(n, vector<int>(n, 1)); //1 not connected, 0 connected for (int i=1;i<n;i++) { if (protocol[i] == 0) { adjlist[host[i]][i] = 0; adjlist[i][host[i]] = 0; } else if (protocol[i] == 1) { for (auto x : adjlist[host[i]]) { if (adjlist[x][host[i]] == 0) { adjlist[i][x] = 0; adjlist[x][i] = 0; } } } else { for (auto x : adjlist[host[i]]) { if (adjlist[x][host[i]] == 0) { adjlist[i][x] = 0; adjlist[x][i] = 0; } } adjlist[host[i]][i] = 0; adjlist[i][host[i]] = 0; } } vector<vector<int>> newadj(n+1, vector<int>()); for (int i=0;i<n;i++) { for (int j=0;j<n;j++) { if (adjlist[i][j]) { newadj[i].push_back(j); newadj[j].push_back(i); } } } int ans = 0; if (protocol[1] == 1) { for (int i=0;i<n;i++) { ans += confidence[i]; } } else if (protocol[1] == 2) { for (int i=0;i<n;i++) { ans = max(ans, confidence[i]); } } 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...