Submission #110820

#TimeUsernameProblemLanguageResultExecution timeMemory
110820shehar48Geppetto (COCI15_geppetto)C++11
8 / 80
3 ms384 KiB
#include <iostream> using namespace std; int main(){ int i,j,n,m,arr[21][21],DP[21],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; } for(i=1;i<=m;i++){ cin>>x>>y; 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 += DP[i]; } cout<<(1 + n + sum)<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...