제출 #1024304

#제출 시각아이디문제언어결과실행 시간메모리
1024304vjudge1친구 (IOI14_friend)C++17
27 / 100
17 ms2804 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; vector<int>adj[1010]; void AE(int x,int y){ adj[x].push_back(y); adj[y].push_back(x); } int bruteforce(int n,int confidence[],int host[],int protocol[]){ for(int i=1;i<n;i++){ if(protocol[i]) for(auto x:adj[host[i]]) AE(x,i); if(protocol[i]%2==0) AE(i,host[i]); } int ans=0; for(int msk=1;msk<1<<n;msk++){ int conf=0; for(int i=0;i<n;i++) if(msk&1<<i) conf+=confidence[i]; for(int i=0;i<n;i++) if(msk&1<<i) for(auto y:adj[i]) if(msk&1<<y) conf=-1; ans=max(ans,conf); } return ans; } int findSample(int n,int confidence[],int host[],int protocol[]){ if(n<=10) return bruteforce(n,confidence,host,protocol); int ans=0,ans2=0; for(int i=0;i<n;i++) ans+=confidence[i],ans2=max(ans2,confidence[i]); return protocol[1]==1?ans:ans2; }

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

friend.cpp: In function 'int bruteforce(int, int*, int*, int*)':
friend.cpp:23:32: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   23 |             for(auto y:adj[i]) if(msk&1<<y)
      |                                ^~
friend.cpp:24:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   24 |                 conf=-1; ans=max(ans,conf);
      |                          ^~~
friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:31:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |     for(int i=0;i<n;i++)
      |     ^~~
friend.cpp:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   33 |  return protocol[1]==1?ans:ans2;
      |  ^~~~~~
#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...