Search found 3 matches

by camilop25
Sat Mar 07, 2009 12:05 am
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 52048

Re: 108 - slow or waiting code?

Your algorithm is very inefficient, that's why it takes so long even on small matrices. I think it's complexity is about O(n^8)!

There's a very straightforward O(n^4) solution, and it's good enough to get accepted.
And then there's an even better O(n^3) algorithm.

An example of this is the 3n+1 ...
by camilop25
Fri Mar 06, 2009 5:03 pm
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 52048

Re: 108 - slow or waiting code?

I tried it with my computer and takes about a half o second solving a 15x15 matrix
You should try a 100x100 matrix. The input description clearly says "N may be as large as 100", so it's very likely that it's about that big in the judge's test.

I solved several problems in the uva, and many ...
by camilop25
Fri Mar 06, 2009 4:21 am
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 52048

108 - slow or waiting code?

Hi to everybody, I did the following code for the problem 108:


#include <iostream>

using namespace std;

int datos[100][100],cantidadLados,maximoActual;

struct Precalculo
{
int valor;
int x1;
int y1;
int x2;
int y2;
Precalculo *siguiente;
};

Precalculo *cabeza;

void agregarPrecalculo ...

Go to advanced search