Search found 215 matches

by ImLazy
Wed May 04, 2011 3:48 am
Forum: Java
Topic: Why Some Thread.sleep() Are Not Interrupted?
Replies: 0
Views: 2475

Why Some Thread.sleep() Are Not Interrupted?

First, see this code. Very simple, there are 20000 threads, named thread1 ~ thread10000 and thread1-sleep ~ thread10000-sleep . Every thread i -sleep sleeps for 1 second and thread i interrupts it: public class InterruptTest { public static void main(String[] args) throws Exception { for (int i = 1;...
by ImLazy
Wed Nov 05, 2008 7:47 am
Forum: C++
Topic: How to define a pointer to a 2-dimesional array of pointers.
Replies: 2
Views: 2395

Re: How to define a pointer to a 2-dimesional array of pointers.

:oops: , I forget to allocate memory for b.
by ImLazy
Wed Nov 05, 2008 6:15 am
Forum: C++
Topic: How to define a pointer to a 2-dimesional array of pointers.
Replies: 2
Views: 2395

How to define a pointer to a 2-dimesional array of pointers.

This code: #include <iostream> using namespace std; int main() { int a[2][3] = { {1, 2, 3}, {4, 5, 6} }; int *(*b)[3]; for (int i = 0; i < 2; i++) for (int j = 0; j < 3; j++) b[i][j] = &a[i][j]; for (int i = 0; i < 2; i++) for (int j = 0; j < 3; j++) cout << *b[i][j] << " "; cout << endl; return 0; ...
by ImLazy
Wed Sep 17, 2008 8:19 am
Forum: Volume 7 (700-799)
Topic: 746 - Polygon Visibility
Replies: 2
Views: 3207

Re: 746 - Polygon Visibility

I've found where I was wrong and I get AC now. This input:

Code: Select all

3 4
20001 3
30001 4
30001 2
10001 4
10001 2
1 1
1 5
0 0
The output should be:

Code: Select all

Instance 1:
0.000
30001 4
30001 2
0.000
But my old program output:

Code: Select all

Instance 1:
0.000
30001 4
30001 2
-0.000
by ImLazy
Mon Sep 15, 2008 4:51 pm
Forum: Volume 7 (700-799)
Topic: 746 - Polygon Visibility
Replies: 2
Views: 3207

If any body get AC, please check my output below.

I just wrote a brute force, enumerated every pair of vertices of the two polygons and find the LEFTMOST and RIGHTMOST line segment, comparing by CROSS PRODUCT. I got WA but not TLE. Could any body who has got AC check my output below? Input: 3 3 3 2 5 3 5 1 1 2 2 3 2 1 4 3 3 4 4 5 4 1 3 2 2 3 1 2 1 ...
by ImLazy
Tue Jan 22, 2008 5:26 pm
Forum: Volume 9 (900-999)
Topic: 963 - Spelling Corrector
Replies: 11
Views: 6017

Jan wrote:But I still don't know whether the judge data is present or not (for this problem).
It seems like you said. I kept getting Runtime Error. But when I submitted a code with only an empty main function, it was Accepted. There is quite something wrong with the test data of this problem.
by ImLazy
Mon Jan 21, 2008 10:09 am
Forum: Volume 9 (900-999)
Topic: 963 - Spelling Corrector
Replies: 11
Views: 6017

Jan wrote:You can apply dp. To be more specific you can use LCS (with minor changes).
You mean, for each given word, calculate its penalty with each word in the dictionary?
by ImLazy
Mon Jan 21, 2008 10:02 am
Forum: Volume 9 (900-999)
Topic: 963 - Spelling Corrector
Replies: 11
Views: 6017

andmej wrote:what is LCS? :oops:
Longest Common Substring (or Subsequence).
by ImLazy
Sun Jan 20, 2008 11:23 am
Forum: Volume 9 (900-999)
Topic: 963 - Spelling Corrector
Replies: 11
Views: 6017

963 - Spelling Corrector

Who can give some hints about the algorithm?
by ImLazy
Sat Nov 24, 2007 11:37 am
Forum: Algorithms
Topic: Suffix tree construction
Replies: 13
Views: 4419

by ImLazy
Thu Nov 22, 2007 4:06 pm
Forum: C++
Topic: Initializing member arrays in constructors
Replies: 1
Views: 1709

Initializing member arrays in constructors

In this code:

Code: Select all

class C {
    int a[10];
    int b;

    C(): b(1) {}
}
Is there any way to initialize the array a in the constructor like the ":b(1)"? I tried "a({0})" and "a(0)" but failed.
by ImLazy
Tue Nov 20, 2007 4:27 pm
Forum: Algorithms
Topic: Suffix tree construction
Replies: 13
Views: 4419

I'm afraid ebookee.com accept only links but not files.
by ImLazy
Tue Nov 20, 2007 9:07 am
Forum: Algorithms
Topic: Suffix tree construction
Replies: 13
Views: 4419

I want to say sorry to those to whom I send the book. I found the djvu file is not complete. It just has the first 6 chapters. I have another pdf version of it, which is not complete either, but has the first 12 chapters. That's enough for the contents of suffix tree. But the pdf file is 15 Mb. It's...
by ImLazy
Mon Nov 19, 2007 5:08 pm
Forum: Volume 107 (10700-10799)
Topic: 10740 - Not the Best
Replies: 23
Views: 12826

I use the MPS algorithm introduced in the article The K shortest paths problem from this page. It's fast.
by ImLazy
Thu Nov 15, 2007 4:55 am
Forum: Algorithms
Topic: Suffix tree construction
Replies: 13
Views: 4419

Yes, I also get it from emule. A 1.1M djvu file. If you want, I can email it to you.

But maybe I will not come to see this post again, so if you want me sent you the book, send me an email or private message.

Go to advanced search