Submission #136132

#TimeUsernameProblemLanguageResultExecution timeMemory
136132arthurconmyFriend (IOI14_friend)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #ifndef ARTHUR_LOCAL #include "friend.h" #endif using namespace std; bool adj[10][10]; int findSample(int n, int C[], int H[], int P[]) { for(int i=1; i<n; i++) { if(P[i]==0) { adj[H[i]][i]=1; adj[i][H[i]]=1; // cout << i << " " << H[i] << endl; } if(P[i]==1) { for(int j=0; j<n; j++) { if(j==H[i]) continue; if(adj[H[i]][j]) { adj[j][i]=1; adj[i][j]=1; } } } if(P[i]==2) { for(int j=0; j<n; j++) { if(adj[H[i]][j] || j==H[i]) { adj[j][i]=1; adj[i][j]=1; } } } } // for(int i=0; i<n; i++) // { // for(int j=0; j<n; j++) cout << int(adj[i][j]) << " "; // cout << endl; // } int ans=0; for(int i=0; i<1024; i++) { vector<int> cur; for(int b=0; b<10; b++) { if((i&1<<b) != 0) cur.push_back(b); } bool works=1; int conf=0; for(int j=0; j<cur.size(); j++) { conf+=C[cur[j]]; for(int k=j+1; k<cur.size(); k++) { if(adj[cur[j]][cur[k]]) works=0; } } if(works) { ans=max(ans,conf); } } cout << ans << endl; return ans; }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:67:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0; j<cur.size(); j++)
                ~^~~~~~~~~~~
friend.cpp:71:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k=j+1; k<cur.size(); k++)
                   ~^~~~~~~~~~~
#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...