제출 #110819

#제출 시각아이디문제언어결과실행 시간메모리
110819shehar48Geppetto (COCI15_geppetto)C++11
8 / 80
4 ms528 KiB
#include <iostream> using namespace std; int main(){ int i,j,n,m,arr[20][20],DP[20],DP_one[20],x,y; cin>>n>>m; for(i=1;i<=n;i++){ for(j=1;j<=n;j++){ if(i==j){ arr[i][i] = 0; } else{ arr[i][j] = 1; } } DP[i] = 0; DP_one[i] = 1; } for(i=1;i<=m;i++){ cin>>x>>y; if(x==0){ DP_one[y] = 0; }else if(y==0){ DP_one[x] = 0; } else{ arr[x][y] = 0; arr[y][x] = 0; } } for(i=1;i<=n;i++){ for(j=i-1;j>=0;j--){ if(arr[i][j] == 1){ DP[i] = DP[i] + DP[j] + 1; } } } int sum = 0; for(i=1;i<=n;i++){ sum = sum + DP[i] + DP_one[i]; } cout<<1 + sum<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...