Search found 28 matches

by MAK
Wed Apr 01, 2009 2:26 pm
Forum: Volume 114 (11400-11499)
Topic: 11475 - Extend to Palindrome
Replies: 32
Views: 13786

Re: 11475 - Extend to Palindromes

Try an input with a large string of the same character with a different character near the end.
e.g.
xxxxxx......xxxy
xxxxxx........xyxx
by MAK
Sat Aug 23, 2008 10:43 pm
Forum: Volume 114 (11400-11499)
Topic: 11475 - Extend to Palindrome
Replies: 32
Views: 13786

Re: 11475 - Extend to Palindromes

IMHO the idea behind the solution (and not the implementation) of this problem is somewhat simpler that the one Hamedv referred to.

Of course, what I find find hard (or easy) can quite naturally seem easy (or hard) to someone else :-).
by MAK
Mon Aug 04, 2008 10:11 pm
Forum: Volume 114 (11400-11499)
Topic: 11475 - Extend to Palindrome
Replies: 32
Views: 13786

Re: 11475 - Extend to Palindromes

Thanks Hamedv. That is a much harder problem. The present problem asks that you only consider adding characters at the end of the string, which simplifies matters a lot.
by MAK
Mon Aug 04, 2008 10:52 am
Forum: Volume 114 (11400-11499)
Topic: 11475 - Extend to Palindrome
Replies: 32
Views: 13786

Re: 11475 - Extend to Palindromes

@baodog:
Your code prints an extra unprintable character at the end of each line on my machine. But it looks otherwise ok.

@hamedv:
I'm curious about the O(n^2) DP you mentioned. The simple brute force way of solving this problem is also O(n^2). Could you please post an outline of your idea?
by MAK
Tue Jul 01, 2008 11:00 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 181645

Re: 100 Time Limit Exceeded

Function calls are certainly not eating up your time. Instead of using two scanners, why don't you use nextInt() on the first scanner? Maybe declaring the Scanner as Scanner getInput=new Scanner(new BufferedInputStream(System.in)); might also help. Java is slower than C++, but this does not really m...
by MAK
Sat May 31, 2008 11:36 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 181645

Re: problem 100 TLE in java?

Suggestions: Use Scanner for input Use longs (the problem statement talks of 32bit ints. Java ints are 32 bits but they are signed so they are effectively 31 bits for positive numbers) Get rid of this line if(num1>10000||num2>10000||num1<0||num2<0)break; Input is guaranteed to be valid, so no need t...
by MAK
Wed Apr 23, 2008 2:45 pm
Forum: Java
Topic: Submiting java code
Replies: 1
Views: 3269

Re: Submiting java code

You don't need the recommended readLn method. Java uspport at this judge has been upgraded and it now fully supports jdk1.6. So, you can simply use Scanner and/or BufferedReader. Make sure that the class with the main method is named Main.
by MAK
Sun Mar 23, 2008 9:38 pm
Forum: Java
Topic: File naming in Java
Replies: 1
Views: 3555

The file name does not have to be Main.java. The driver class in the file should be named Main. The file name can be anything you want provided that the class Main is not declared public.
by MAK
Wed Dec 19, 2007 12:26 pm
Forum: Volume 107 (10700-10799)
Topic: 10750 - Beautiful Points
Replies: 21
Views: 12897

WA using line sweep

I tried this problem with a line sweep algo, but I keep getting WA. The same approach passed in 10245. Can anyone suggest some tricky test cases?

Thanks in advance,
MAK
by MAK
Sat Jun 09, 2007 12:04 pm
Forum: Algorithms
Topic: Algorithm based help? Needed,plz..........
Replies: 4
Views: 2513

Try the easier problems first (e.g. ad-hoc, simple geometry/math). Whenever you run into any trouble, consult this forum as well as any other forums/groups/mailing lists. Just looking up the previous posts on the subject should generally be sufficient to point you in the right direction. Whenever yo...
by MAK
Sat Jun 09, 2007 10:53 am
Forum: Off topic (General chit-chat)
Topic: What is your record of solved problems during one day?
Replies: 18
Views: 68725

Giving up

it has been a week here in acm.uva.es, i havent solved a single one
That's not really as bad as you think. I got some 20+ compile errors and a few WAs before I got my first accepted solution (I used to code in Java).
by MAK
Wed Jan 17, 2007 8:38 pm
Forum: Volume 111 (11100-11199)
Topic: 11150 - Cola
Replies: 43
Views: 22674

Borrowing two bottles

MAK wrote: You migth also have (to borrow) two bottles. I actually wrote You migth also have two bottles. (sorry for the typo :) ) What I meant was that at the end of the simulation you can have either one or two empty bottles left, but never three. So you can either borrow one or two bottles and s...
by MAK
Wed Jan 03, 2007 7:30 pm
Forum: Volume 100 (10000-10099)
Topic: 10055 - Hashmat the Brave Warrior
Replies: 166
Views: 45877

double?

I think I solved it with long long (C++) instead of double. But double works too I guess.
by MAK
Tue Jan 02, 2007 10:38 pm
Forum: Java
Topic: JAVA-Difficulties We Face
Replies: 31
Views: 26287

Interesting

I just saw something very interesting at the Bug Fixes forum. Someone (probably one of the system admins) says that 1. Java uses 190+ MB of RAM just for a single System.out.println 2. Java is 'unsecure'. Java classes may illegally access system data or files. I'm quite sure that the second statement...
by MAK
Tue Jan 02, 2007 10:19 pm
Forum: General
Topic: Languages used by top UVA users.
Replies: 2
Views: 4386

hm... as far as I am concerned the only allowed languages should be those allowed in ACM World Finals + Pascal... Regards That's what I used to think before I learnt C#, Python and LISP. I don't think there is any reason to keep such a limited set of allowed languages. Probably more people use Pyth...

Go to advanced search