제출 #127944

#제출 시각아이디문제언어결과실행 시간메모리
127944Boxworld친구 (IOI14_friend)C++14
0 / 100
2 ms424 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; int a[20][20],ok[20],C[20],ans=0,s=0; void dfs(int p,int n){ if (p==n)return; if (ok[p]==0){ s+=C[p]; ans=max(ans,s); for (int i=p+1;i<n;i++) if (a[p][i]==1)ok[i]=1; dfs(p+1,n); for (int i=p+1;i<n;i++) if (a[p][i]==1)ok[i]=0; s-=C[p]; } dfs(p+1,n); } int findSample(int n,int confidence[],int host[],int protocol[]){ if (n<=10){//task1 memset(a,0,sizeof(a)); memset(ok,0,sizeof(ok)); for (int i=0;i<n;i++)C[i]=confidence[i]; for (int i=1;i<n;i++){ int P=protocol[i]; if (P==0||P==2)a[host[i]][i]=a[i][host[i]]=1; if (P==1||P==2) for (int j=0;j<n;j++) if (a[host[i]][j]==1)a[j][i]=a[i][j]=1; } dfs(0,n); }else{ if (protocol[1]=0){//task4 }else if(protocol[1]=1){//task2 }else{//task3 } } return ans; }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:33:18: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   if (protocol[1]=0){//task4
       ~~~~~~~~~~~^~
friend.cpp:35:23: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   }else if(protocol[1]=1){//task2
            ~~~~~~~~~~~^~
#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...