Try an input with a large string of the same character with a different character near the end.
e.g.
xxxxxx......xxxy
xxxxxx........xyxx
Search found 28 matches
- Wed Apr 01, 2009 2:26 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11475 - Extend to Palindrome
- Replies: 32
- Views: 20521
- Sat Aug 23, 2008 10:43 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11475 - Extend to Palindrome
- Replies: 32
- Views: 20521
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
.
Of course, what I find find hard (or easy) can quite naturally seem easy (or hard) to someone else

- Mon Aug 04, 2008 10:11 pm
- Forum: Volume 114 (11400-11499)
- Topic: 11475 - Extend to Palindrome
- Replies: 32
- Views: 20521
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.
- Mon Aug 04, 2008 10:52 am
- Forum: Volume 114 (11400-11499)
- Topic: 11475 - Extend to Palindrome
- Replies: 32
- Views: 20521
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?
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?
- Tue Jul 01, 2008 11:00 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 317984
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 ...
Scanner getInput=new Scanner(new BufferedInputStream(System.in));
might also help.
Java is slower than C++, but this does not ...
- Sat May 31, 2008 11:36 pm
- Forum: Volume 1 (100-199)
- Topic: 100 - The 3n + 1 problem
- Replies: 1394
- Views: 317984
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 ...
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 ...
- Wed Apr 23, 2008 2:45 pm
- Forum: Java
- Topic: Submiting java code
- Replies: 1
- Views: 4289
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.
- Sun Mar 23, 2008 9:38 pm
- Forum: Java
- Topic: File naming in Java
- Replies: 1
- Views: 4641
- Wed Dec 19, 2007 12:26 pm
- Forum: Volume 107 (10700-10799)
- Topic: 10750 - Beautiful Points
- Replies: 21
- Views: 15258
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
Thanks in advance,
MAK
- Sat Jun 09, 2007 12:04 pm
- Forum: Algorithms
- Topic: Algorithm based help? Needed,plz..........
- Replies: 4
- Views: 3075
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 ...
- 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: 73817
Giving up
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).it has been a week here in acm.uva.es, i havent solved a single one
- Wed Jan 17, 2007 8:38 pm
- Forum: Volume 111 (11100-11199)
- Topic: 11150 - Cola
- Replies: 43
- Views: 30366
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 ...
- Wed Jan 03, 2007 7:30 pm
- Forum: Volume 100 (10000-10099)
- Topic: 10055 - Hashmat the Brave Warrior
- Replies: 166
- Views: 77258
double?
I think I solved it with long long (C++) instead of double. But double works too I guess.
- Tue Jan 02, 2007 10:38 pm
- Forum: Java
- Topic: JAVA-Difficulties We Face
- Replies: 31
- Views: 31394
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 ...
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 ...
- Tue Jan 02, 2007 10:19 pm
- Forum: General
- Topic: Languages used by top UVA users.
- Replies: 2
- Views: 5401