Try using a table with hashing function: You store the values of (a+b) there, and check them for appropriate values of (d-c). If you use a very good hashing function or a double-hashing algorythm and choose the best constants, then your program may run faster than 0.5s!!!
Just got AC. :D But my ...
Search found 2 matches
- Sun Jul 06, 2003 9:47 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10125 - Sumsets
- Replies: 50
- Views: 24046
- Mon Jun 16, 2003 11:34 pm
- Forum: Volume 3 (300-399)
- Topic: 323 - Jury Compromise
- Replies: 10
- Views: 6623
323 - Jury compromise - WA
I can't see any mistake in this code - it's dynamic programming. Could you please help me with some test cases?
[pascal]program p323;
type rec=record d,p,ind:byte; end;
var t:array[1..201,-201..201,0..20] of record w:byte; s:integer; end;
x,n,m,j,i,il,sp,sd,l,k,p:integer;
ci,cj:boolean;
tab:array ...
[pascal]program p323;
type rec=record d,p,ind:byte; end;
var t:array[1..201,-201..201,0..20] of record w:byte; s:integer; end;
x,n,m,j,i,il,sp,sd,l,k,p:integer;
ci,cj:boolean;
tab:array ...