mafia's blog

By mafia, 11 years ago, In English

Could someone help me with this task. I have a solution but it is saying Runtime error. Could someone say why? Here is my code:

#include<stdio.h>
#include<algorithm>
using namespace std;
int d[2002][102][102];
int a[102][102],n,m;
main()
{
    freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
    int i,j,k,l,v;
    scanf("%d%d",&n,&m);
    for (i=1;i<=n;i++)
        for (j=1;j<=n;j++)
            scanf("%d",&a[i][j]);
    d[0][0][1]=1;
    for (l=1;l<=m;l++)
        {
        for (i=1;i<=n;i++)
            {
            for (j=1;j<=n;j++)
                {
                v=max(max(d[l-1][i-1][j],d[l-1][i+1][j]),max(d[l-1][i][j-1],d[l-1][i][j+1]));
                if(v!=0)d[l][i][j]=v+a[i][j];
                if(i==j&&l==1&&i==1)d[l][i][j]--;
                if(l==m)
                    {
                    if(i==j&&i==1)
                        k=d[l][i][j];
                    k=max(k,d[l][i][j]);
                    }
                }
            }
        }
    printf("%d\n",k);
    return 0;
}

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By mafia, 12 years ago, In English

Good day everyone!

I'm studying in a school, yet. I'm interested in a question: What if I will take medal in IOI? Would it help me after graduating the school? If it helped someone, so please tell me how? It is very important for me.

Thanks for your attention!

Full text and comments »

  • Vote: I like it
  • -19
  • Vote: I do not like it

By mafia, 13 years ago, In English
Good afternoon programmers!

I think all interestingly to esteem what be a ridiculous joke. Jokes cheer all up, please all. I think to such people as we even it is useful to read in day some ridiculous jokes. As we programmers, at us work brain and sometimes it is overflowed or simply gets tired, and sometimes we simply do not have mood or what be a bug I irritate also I think, that very good way, it to distract allready read any ridiculous joke and with new forces to continue work) further And still it is interesting to mine to read all jokes about itself - programmers) Thus we can keep to ourselves nerves and working capacity this day. Therefore I have solved that will be good if we make such room where people will share and please each other with jokes)

Full text and comments »

  • Vote: I like it
  • -23
  • Vote: I do not like it

By mafia, 13 years ago, In English
I want to create my own contest, but I don't know how to do it. If you know tell me please.

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it

By mafia, 13 years ago, In English

Who can say me how to increase my rating at this website, I can't understand how does rating system work at Codeforces. Please help if you know.

Full text and comments »

  • Vote: I like it
  • -37
  • Vote: I do not like it

By mafia, 13 years ago, In English

I believe train.usaco.org is the best web site to prepare yourself to IOI. There is also some contests for example bronze contest, silver contest, gold contest and etc. If bronze contest's problems was easy for you I am sure that you can take at least bronze medal at IOI. Check it maybe it will help you =).

If you need any help you can ask me [email protected].

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it