제출 #520903

#제출 시각아이디문제언어결과실행 시간메모리
520903peti1234친구 (IOI14_friend)C++17
16 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; int findSample(int n, int con[], int h[], int p[]) { // 1 if (n<=10) { bool el[10][10]; for (int i=0; i<n; i++) { for (int j=0; j<n; j++) { el[i][j]=0; } } for (int i=1; i<=n-1; i++) { if (p[i]==1 || p[i]==3) { el[i][h[i]]=1, el[h[i]][i]=1; } if (p[i]==2 || p[i]==3) { for (int j=0; j<n; j++) { if (el[j][h[i]]) { el[i][j]=1, el[j][i]=1; } } } } int valasz=0; for (int mask=0; mask<(1<<n); mask++) { int ert=0; for (int i=0; i<n; i++) { if (mask & (1<<i)) { ert+=con[i]; } } bool jo=1; for (int i=0; i<n; i++) { for (int j=0; j<n; j++) { if ((mask & (1<<i)) && (mask & (1<<j)) && el[i][j]) { jo=0; } } } if (jo) { valasz=max(valasz, ert); } } return valasz; } // 2 if (p[1]==2) { int valasz=0; for (int i=0; i<n; i++) { valasz=max(valasz, con[i]); } return valasz; } // 3 if (p[1]==3) { int valasz=0; for (int i=0; i<n; i++) { valasz+=con[i]; } return valasz; } }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:68:1: warning: control reaches end of non-void function [-Wreturn-type]
   68 | }
      | ^
#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...