Submission #1184322

#TimeUsernameProblemLanguageResultExecution timeMemory
1184322pensiveFriend (IOI14_friend)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> #include <vector> #include <algorithm> using namespace std; #define ll long long #define REP(a,i,n) for (int i=a;i<n;i++) #define f first #define s second void iayf(int n, int i, int host, vector<vector<int>> &adjList) { adjList[host][i]=1; adjList[i][host]=1; } void mfayf(int n, int i, int host, vector<vector<int>> &adjList) { REP(0,j,n) { if (adjList[host][j]==1) { adjList[j][i]=1; adjList[i][j]=1; } } } void wayf(int n, int i, int host, vector<vector<int>> &adjList) { mfayf(n,i,host,adjList); iayf(n, i, host, adjList); } int maxSample(int n, int i, vector<vector<int>> &adjList, vector<int> &includes, int confidence[]) { if (i==n) { return 0; } int cleared=0; REP(0,j,n) { if (adjList[i][j]==1) { cleared += includes[j]; } } int ans= maxSample(n,i+1,adjList,includes,confidence); if (cleared==0) { includes[i]=1; ans = max(ans, confidence[i]+maxSample(n,i+1,adjList,includes,confidence)); includes[i]=0; } return ans; } int findSample(int n, int confidence[], int host[], int protocol[]) { if (n>10 && protocol[1]==1) { int sm=0; REP(0,i,n) { sm += confidence[i]; } return sm; } vector<vector<int> > adjList(n, vector<int>(n, 0)); REP(1,i,n) { if (protocol[i]==0) iayf(n,i,host[i],adjList); else if (protocol[i]==1) mfayf(n,i,host[i],adjList); else if (protocol[i]==2) wayf(n,i,host[i],adjList); } cout << '\t'; REP(0,j,n) cout << j << ' '; cout << '\n'; REP(0,i,n) { cout << i << '\t'; REP(0,j,n) { cout << adjList[i][j] << ' '; } cout << '\n'; } vector<int> includes(n, 0); return maxSample(n,0,adjList,includes,confidence); } int main() { int n=6; int confidence[n] = {13, 3, 6, 20, 10, 15}, host[n] = {0, 0, 0, 1, 2, 0}, protocol[n] = {0, 0, 1, 2, 1, 0}; cout << findSample(n,confidence,host,protocol); }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc549Wyr.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccVg7S7K.o:friend.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status