제출 #1017962

#제출 시각아이디문제언어결과실행 시간메모리
1017962n3rm1n친구 (IOI14_friend)C++17
19 / 100
18 ms4208 KiB
#include <bits/stdc++.h> #define endl '\n' #include "friend.h" using namespace std; long long ans = 0; long long are[1005][1005], c[1005]; long long N, used[1005]; void check() { vector < int > g; long long all = 0; for (int i = 0; i < N; ++ i) { if(used[i]) { g.push_back(i); all += c[i]; } } for (int i = 0; i < g.size(); ++ i) { for (int j = i+1; j < g.size(); ++ j) if(are[g[i]][g[j]])return; } ans = max(ans, all); } void gen(int pos) { if(pos == N) { check(); return; } used[pos] = 0; gen(pos+1); used[pos] = 1; gen(pos+1); } int cntp[4]; int findSample(int n, int confidence[], int host[], int protocol[]) { N = n; for (int i = 0; i < n; ++ i) cntp[protocol[i]] ++; if(n <= 10) { c[0] = confidence[0]; for (int i = 1; i < n; ++ i) { c[i] = confidence[i]; if(protocol[i] == 0) { are[i][host[i]] = 1; are[host[i]][i] = 1; } else { for (int j = 0; j < n; ++ j) { if(are[j][host[i]]) { are[i][j] = 1; are[j][i] = 1; } } if(protocol[i] == 2) { are[i][host[i]] = 1; are[host[i]][i] = 1; } } } gen(0); return ans; } if(cntp[2] == n-1) { long long maxx = 0; for (int i = 0; i < n; ++ i) { maxx = max(maxx, 1LL * confidence[i]); } return maxx; } }

컴파일 시 표준 에러 (stderr) 메시지

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