#include "stdio.h"
#include "malloc.h"
struct rib
{
int from;
int to;
int weight;
} ;
int main( int argc, char const * argv[ ] )
{
struct rib * incidental;
for ( int i = 0 ; i < 12 ; ++ i)
{
incidental = NULL;
for ( int j = 0 ; j < 3 ; ++ j)
{
incidental
= ( struct rib
* ) realloc ( incidental
, ( j
+ 1 ) * sizeof ( struct rib
) ) ; if ( incidental == NULL)
{
printf ( "NULL YOU are fool!!!!!!\n " ) ; }
incidental[ j] .from = j+ 1 ;
incidental[ j] .to = ( j+ 1 ) * 2 ;
incidental[ j] .weight = ( j+ 1 ) * 4 ;
}
for ( int k = 0 ; k < 3 ; ++ k)
{
printf ( " %i-%i=%i\n " , incidental
[ k
] .
from , incidental
[ k
] .
to , incidental
[ k
] .
weight ) ; }
}
}
I2luY2x1ZGUgInN0ZGlvLmgiCiNpbmNsdWRlICJtYWxsb2MuaCIKCgpzdHJ1Y3QgcmliCnsKICAgIGludCBmcm9tOwogICAgaW50IHRvOwogICAgaW50IHdlaWdodDsKfTsKCmludCBtYWluKGludCBhcmdjLCBjaGFyIGNvbnN0ICphcmd2W10pCnsKICAgIHN0cnVjdCByaWIgKmluY2lkZW50YWw7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMjsgKytpKQogICAgewogICAgICAgIGluY2lkZW50YWwgPSBOVUxMOwogICAgICAgIGZvciAoaW50IGogPSAwOyBqIDwgMzsgKytqKQogICAgICAgIHsKICAgICAgICAgICAgcHJpbnRmKCJvayAlaVxuIiwgaik7CiAgICAgICAgICAgIGluY2lkZW50YWwgPSAoc3RydWN0IHJpYiopcmVhbGxvYyhpbmNpZGVudGFsLCAoaisxKSpzaXplb2Yoc3RydWN0IHJpYikpOwogICAgICAgICAgICBpZiAoaW5jaWRlbnRhbCA9PSBOVUxMKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBwcmludGYoIk5VTEwgWU9VIGFyZSBmb29sISEhISEhXG4iKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBpbmNpZGVudGFsW2pdLmZyb20gPSBqKzE7CiAgICAgICAgICAgIGluY2lkZW50YWxbal0udG8gPSAoaisxKSoyOwogICAgICAgICAgICBpbmNpZGVudGFsW2pdLndlaWdodCA9IChqKzEpKjQ7CiAgICAgICAgfQoKICAgICAgICBmb3IgKGludCBrID0gMDsgayA8IDM7ICsraykKICAgICAgICB7CiAgICAgICAgICAgIHByaW50ZigiICVpLSVpPSVpXG4iLCBpbmNpZGVudGFsW2tdLmZyb20sIGluY2lkZW50YWxba10udG8sIGluY2lkZW50YWxba10ud2VpZ2h0KTsKICAgICAgICB9CiAgICB9CgoKfQ==