# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110819 | shehar48 | Geppetto (COCI15_geppetto) | C++11 | 4 ms | 528 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |