제출 #237003

#제출 시각아이디문제언어결과실행 시간메모리
237003crossing0ver친구 (IOI14_friend)C++17
11 / 100
229 ms65540 KiB
#include<bits/stdc++.h> #include "friend.h" using namespace std; const int MAXN = 1E5+5; int n,val[MAXN]; vector<int> adj[MAXN]; int case1(){ int mxval = 0; for (int i = 0; i < (1 << n); i++) { vector<int> x; x.clear(); for (int j = 0; j < n; j++) { if ( (1 << j) & i) x.push_back(j); } bool flag = 1; for (int j:x) { for (int k:x) { for (int h : adj[j]) if (h == k) flag = 0; } } if (flag) { int s = 0; for (int j:x) s += val[j]; mxval = max(mxval,s); } } return mxval; } int findSample(int n1,int confidence[],int host[],int protocol[]){ n = n1; int type[] = {1,1,1}; for (int i =0; i < n; i++) val[i] = confidence[i]; for (int i = 1; i < n; i++) { int x = protocol[i]; int v = host[i]; for (int j =0; j< 3; j++) if (x != j ) type[j] = 0; if (x == 0) { adj[v].push_back(i); adj[i].push_back(v); } else { for (int f:adj[v]) adj[i].push_back(f), adj[f].push_back(i); if (x == 2) { adj[i].push_back(v); adj[v].push_back(i); } } } if (n <= 10) return case1(); return 1; }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:33:6: warning: variable 'type' set but not used [-Wunused-but-set-variable]
  int type[] = {1,1,1};
      ^~~~
#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...