Search found 132 matches

by Revenger
Wed Aug 18, 2004 6:01 pm
Forum: Volume 105 (10500-10599)
Topic: 10559 - Blocks
Replies: 37
Views: 17089

I think that 0.8 sec can be achieved using a O(n^3) algorithm. I am not sure about that 0.2 sec can be achieved but I belive. Abishek, please, check your inbox.
by Revenger
Wed Aug 18, 2004 9:00 am
Forum: Volume 105 (10500-10599)
Topic: 10559 - Blocks
Replies: 37
Views: 17089

I used dynamic memory allocation to minimaze memory usage.

type tarr = array[1..maxn]of word;
parr = ^tarr;
var inf : array[1..maxn, 1..maxn]of parr;

...

getmem(inf[i, j], (j - i + 1) shl 1)

To speed-up my solution I used 2 ideas:
1.) if inf[i, j, k] = 0 then you should not consider this ...
by Revenger
Tue Aug 17, 2004 8:49 pm
Forum: Volume 105 (10500-10599)
Topic: 10559 - Blocks
Replies: 37
Views: 17089

But how you calculate a[j]? Please, explain it. I used 3-dim array to store maximum score in reducing i-j with the last color being the color of j and length k and another 3-dim array to speed-up seeking in the first array.
by Revenger
Tue Aug 17, 2004 4:39 pm
Forum: Volume 105 (10500-10599)
Topic: 10559 - Blocks
Replies: 37
Views: 17089

Yes, I have seen you submision :)
But you write
please refer to gush's post in the other thread(use search for 10559)

gush wrote

color[z] must be defferent from color[z + 1] and
color[z + 1] should be the same as color

This aproach is wrong. You also should consider then color[z] and color ...
by Revenger
Tue Aug 17, 2004 6:44 am
Forum: Volume 105 (10500-10599)
Topic: 10559 - Blocks
Replies: 37
Views: 17089

Thanks, but I've got Accepted already. I used the same aproach as gush. But I wonder how to get Accepted under 1 sec ?! My solution work 1.652 sec and 4988 KB.
by Revenger
Fri Aug 13, 2004 9:55 am
Forum: Volume 105 (10500-10599)
Topic: 10559 - Blocks
Replies: 37
Views: 17089

10559 TLE

I've got TimeLimitExceeded with my DP algorithm:

Let Inf[i, j, k] be the highest score that I can get from i postion to j position clicking j-th box at last and length of the last segment is k

Then

Inf[i, i, 1] = 1
Inf[i, i + 1, 1] = 2 if color[i] <> color[i + 1]
Inf[i, i + 1, 2] = 4 if color ...
by Revenger
Sun Aug 08, 2004 3:27 pm
Forum: Volume 106 (10600-10699)
Topic: 10647 - Optimal House Placement
Replies: 3
Views: 2969

I've got many WA's
Please tell me what can be wrong? are there any tricks ?

Soory, I've found the error
by Revenger
Sat Aug 07, 2004 5:51 pm
Forum: Volume 106 (10600-10699)
Topic: 10686 - SQF Problems
Replies: 21
Views: 15755

Word is a string formed only by 'a'..'z', 'A'..'Z'
fun&games - 2 words
better4you - 2 words

I used such code to parse the text

[pascal] s := s + ' ';
t := '';
for i := 1 to length(s) do
if s in ['a'..'z', 'A'..'Z'] then t := t + s else
if t <> '' then begin process_word(t); t := ''; end ...
by Revenger
Fri Jul 02, 2004 10:24 am
Forum: Volume 106 (10600-10699)
Topic: 10679 - I Love Strings!!
Replies: 101
Views: 68884

Bad test data

Let's talk about 10679's tests. I think that they are very easy.

First of all, if in Aho-Corasick you compute failure function in dfs order you got accepted. That's very strage, because almost every randomized test check this.

Aho-Corasick have complexity O(m + z), where z is the number of ...
by Revenger
Fri Jul 02, 2004 9:20 am
Forum: Volume 106 (10600-10699)
Topic: 10679 - I Love Strings!!
Replies: 101
Views: 68884

Thanks, ulin! It was really helpful for me - I've got Accepted :)
by Revenger
Wed Jun 30, 2004 7:05 pm
Forum: Volume 106 (10600-10699)
Topic: 10679 - I Love Strings!!
Replies: 101
Views: 68884

Can anyone explain me why my code (it was accepted 3 days later) gets TLE :evil: . I am using KMP

[pascal]{$A-,B-,D+,E+,F-,G-,I-,L-,N-,O+,P-,Q-,R-,S-,T-,V-,X+}
const maxlen = 110000;

type my_string = record
len : longint;
sa : array[1..maxlen]of char;
end;

procedure read_str(var a : my_string ...
by Revenger
Wed Sep 03, 2003 7:04 pm
Forum: Volume 105 (10500-10599)
Topic: 10542 - Hyper-drive
Replies: 9
Views: 7609

Strange..

It is really very strange, because the same code in C++ get Accepted. Why it happened?
by Revenger
Wed Sep 03, 2003 3:23 pm
Forum: Volume 105 (10500-10599)
Topic: 10542 - Hyper-drive
Replies: 9
Views: 7609

Need help

I write a program using PIE but it get WA. Please, help me!

[pascal]Program p10542;

Var T, t_id : Integer;
i, D : Integer;
j : Int64;
a, b : Array[1..10]of Int64;

function gcd(a, b : Int64) : Int64;
begin
if a = 0 then gcd := b else gcd := gcd(b mod a, a);
end;

procedure rec(id, v ...
by Revenger
Tue Sep 02, 2003 9:32 pm
Forum: Volume 105 (10500-10599)
Topic: 10542 - Hyper-drive
Replies: 9
Views: 7609

I also got WA many times.
My program output in the last test case "15484". I think it is right. Can anybody explain to me why the answer 15484 is incorrect.

Look at my program for my algorithm (I can't explain it using only words :) ):

[pascal]Program p10542;

Type Integer = Int64;

Var T, t_id ...
by Revenger
Mon Sep 01, 2003 2:44 pm
Forum: Volume 105 (10500-10599)
Topic: 10547 - Hidden Truth in Recurrence
Replies: 7
Views: 3885

Thanks, I get AC 8)

Go to advanced search