Search found 3 matches

by ocin_lr
Sat Aug 01, 2015 5:50 pm
Forum: Volume 127 (12700-12799)
Topic: 12782 - Magic Squares
Replies: 3
Views: 3614

Re: 12782 - Magic Squares

Here there are some test cases you might try. The solution is in http://www.udebug.com/UVa/12782 :
1 2 3 4 5 6 7 8 9
1 14 4 14 11 7 6 9 8 13 10 2 10 3 5 15
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 8
1 2 3 4
1 1 -1 -1
1 1 1 1
-1 -1 -1 -1
1 1 1
0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 3 1 2 ...
by ocin_lr
Sat Aug 01, 2015 5:48 pm
Forum: Volume 127 (12700-12799)
Topic: 12782 - Magic Squares
Replies: 3
Views: 3614

Re: 12782 - Magic Squares

Hi,

I have tried this problem using Backtracking with pruning in C++, but so far my code is not fast enough.

The pruning I do is the following(lets call N the amount of numbers, nn the square root of N, S the modulo of the Magic Square):
- if N==1, then Yes
- otherwise if N!=4 && N!=9 && N!=16 ...
by ocin_lr
Mon Jul 06, 2015 7:55 pm
Forum: Volume 7 (700-799)
Topic: 785 - Grid Colouring
Replies: 27
Views: 18705

Re: 785 - Grid Colouring

Hi, Everyone,

I don't know for you, but for me this problem was a little bit tricky and the previous forum replies were not helpful enough. Here some Tips:

1- As suggested for this problem (and I recommend it also for all problems), you should use static arrays a little bit larger than the limits ...

Go to advanced search