CodeChef submission 595754 (C++ 4.3.2) plaintext list. Status: TLE, problem SUMTRIAN, contest . By gagangupt16 (gagangupt16), 2011-07-08 23:08:00.
#include <iostream> #include <vector> #include <math.h> using namespace std; vector<int> bi; void bindg(int i) { int j; for (j=0;j<bi.size();j++){ bi[j]=i%2; i/=2; } } int main() { vector<vector<int> > v; int y,tc,n,i,j,pres=0,high=0,b,ptr; for (y=0;y<tc;y++){ v.resize(n); for (i=0;i<n;i++) v[i].resize(i+1); for (i=0;i<n;i++) for (j=0;j<i+1;j++) bi.resize(n-1); b=n-2; for (i=0;i<pow(2,n-1);i++){ pres=v[0][0]; b=n-2; ptr=0; bindg(i); for (j=1;j<=n-1;j++){ ptr+=bi[b]; pres+=v[j][ptr]; b--; } if (pres>high) high=pres; } } return 0; }
Comments

