Submission #1017209

#TimeUsernameProblemLanguageResultExecution timeMemory
1017209n3rm1nFriend (IOI14_friend)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #define endl '\n' #include "friend.h" using namespace std; vector < int > g[1005]; int cnt[4]; int findSample(int n, int confidence[], int host[], int protocol[]) { for (int i = 1; i < n; ++ i) g[host[i]].push_back(i); for (int i = 1; i < n; ++ i) { cnt[protocol[i]] ++; } if(cnt[1] == n-1) { long long curr = 0, ans = 0; for (int i = 0; i < n; ++ i) { curr = confidence[i]; for (int j = 0; j < g[i].size(); ++ j) curr += confidence[g[i][j]]; ans = max(ans, curr); } return ans; } }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:21:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             for (int j = 0; j < g[i].size(); ++ j)
      |                             ~~^~~~~~~~~~~~~
friend.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
   27 | }
      | ^
#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...