Search found 128 matches

by lbv
Tue Aug 12, 2014 9:34 am
Forum: Volume 1 (100-199)
Topic: 161 - Traffic Lights
Replies: 28
Views: 3988

Re: 161 - Traffic Lights

Hi, I have a problem. The following code got TLE(..) But this one got AC: (..) Why EOF doesn't work? The judge's data probably has some strange characters at the end of the file, which is something not too uncommon in UVa's archives. It seems like the most likely scenario is that at some point scan...
by lbv
Fri Aug 08, 2014 9:56 pm
Forum: Volume 112 (11200-11299)
Topic: 11221 - Magic square palindromes.
Replies: 58
Views: 20722

Re: 11221 - Magic square palindromes

Shahidul.CSE wrote:Why WA? I tested all sample inputs on this topic. My code is always giving correct output.
Try:

Input

Code: Select all

2
b ex?e,)(me,!x?eb
)m!!vv m
Output

Code: Select all

Case #1:
3
Case #2:
2
by lbv
Fri Aug 08, 2014 9:20 pm
Forum: Volume 114 (11400-11499)
Topic: 11459 - Snakes and Ladders
Replies: 33
Views: 14691

Re: 11459 - Snakes and Ladders

axelblaze wrote:do I need to terminate as soon any player reaches 100..?
From the problem statement: A player wins when his or her token reached the square numbered 100. At that point, the game ends.
by lbv
Thu Aug 07, 2014 9:24 pm
Forum: Volume 104 (10400-10499)
Topic: 10449 - Traffic
Replies: 58
Views: 21697

Re: 10449 - Traffic

I tried with (..) but it also failed... :( and gave me same verdict... :/ what kind of strange character can appear in end of file ??? would you please give me a example ??? it will really help.... :) Anything that doesn't conform to what scanf understands as an integer would cause the problem. EOF...
by lbv
Thu Aug 07, 2014 10:45 am
Forum: Volume 104 (10400-10499)
Topic: 10449 - Traffic
Replies: 58
Views: 21697

Re: 10449 - Traffic

Got TLE... Help please... :( The method you use to read input: while(~scanf("%d",&n)) is interesting, but it gets the program stuck in an infinite loop if the input happens to contain strange characters at the end of the file, which apparently is the case for this problem. You could try instead: wh...
by lbv
Thu Aug 07, 2014 5:23 am
Forum: Volume 102 (10200-10299)
Topic: 10258 - Contest Scoreboard
Replies: 87
Views: 34486

Re: 10258 - Contest Scoreboard

Hi, I've read all the posts and tried all the test cases, but still getting WA. I also have considered the blank line after the last test case. Please help :( Try: Input 3 1 1 4 R 1 1 10 I 2 1 127 C 5 1 145 C 4 1 225 U 1 1 237 C 5 1 280 C 1 1 285 I 3 1 286 C 2 1 292 C 1 1 293 C 3 1 297 C 4 1 16 C 4...
by lbv
Wed Aug 06, 2014 5:18 pm
Forum: Volume 124 (12400-12499)
Topic: 12442 - Forwarding Emails
Replies: 31
Views: 13965

Re: 12442 - Forwarding Emails

nbacool2 wrote:(..) I still get WA on the judge. Any ideas?
Always print a newline at the end of a test case, including the last one.
by lbv
Sun Aug 03, 2014 7:11 pm
Forum: Volume 120 (12000-12099)
Topic: 12032 - The Monkey and the Oiled Bamboo
Replies: 23
Views: 6866

Re: 12032

Shahidul.CSE wrote:My code giving correct output for every sample input given on this topic . But having WA. Whats wrong with my code?
You may try:

Input

Code: Select all

2
4
4 7 9 11
6
5 9 12 14 15 20
Output

Code: Select all

Case 1: 5
Case 2: 6
by lbv
Sun Aug 03, 2014 7:03 pm
Forum: Volume 113 (11300-11399)
Topic: 11340 - Newspaper
Replies: 154
Views: 43375

Re: 11340 - Newspaper

I got Runtime error, and i'm not sure if it's because of spacing, or overflow, or both. Help? Carefully check this fragment of code: int numLines = Integer.parseInt(br.readLine()); for(int j=0; j<numLetters; j++) process(br.readLine(), hm); Is numLetters the variable you meant to use in that loop? ...
by lbv
Sun Aug 03, 2014 6:11 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 42048

Re: Problem 102 - Same algorithm, TLE in Java, AC in C++11

(..) Java version got TLE; while C++11 version got AC by 0.042sec. Is there any reason about this? I think it is a combination of two things: 1) The judge may have a relatively large input for this problem. Many problems have small input and in those cases (where the input is just a few bytes or kB...
by lbv
Tue Jul 29, 2014 12:23 pm
Forum: Volume 101 (10100-10199)
Topic: 10107 - What is the Median?
Replies: 74
Views: 18625

Re: 10107 - What is the Median?

It does work along those test cases. It doesn't. If you can get past your natural skepticism, my friend, you can see here the output from your program (see at the bottom). Compare it with the expected output. Using nth_element seems like an interesting idea, but if you call it two consecutive times...
by lbv
Tue Jul 29, 2014 11:12 am
Forum: Volume 101 (10100-10199)
Topic: 10107 - What is the Median?
Replies: 74
Views: 18625

Re: 10107 - What is the Median?

mratan16 wrote:I cannot seem to figure out why my code is wrong. Please help
The program you posted doesn't pass the sample cases given in the problem statement. Check that you're printing the newline characters properly.

Also try:

Input

Code: Select all

1
1
2
2
8
8
9
9
5
6
Output

Code: Select all

1
1
1
1
2
2
2
5
5
5
by lbv
Mon Jul 28, 2014 9:58 pm
Forum: Volume 5 (500-599)
Topic: 599 - The Forrest for the Trees
Replies: 18
Views: 7731

Re: 599-The forest for the trees

I'm having an issue with my code. It works for the sample input but I get RE when submitting Try configuring your compiler to show you all possible warnings, as that may help you catch subtle bugs. For example, when I compiled your code, I received: p.cpp: In function ‘int main()’: p.cpp:64:17: war...
by lbv
Mon Jul 28, 2014 9:43 pm
Forum: Volume 100 (10000-10099)
Topic: 10036 - Divisibility
Replies: 37
Views: 10850

Re: 10036 - Divisibility

Is there any algorithms faster than DP on index and mod ?? I don't know of any strategy other than one with O(NK) time complexity, but it can be done using only O(K) space, which may speed up the implementation, if that's what you want. this is my code : Please don't post AC code in the forums. I i...
by lbv
Mon Jul 28, 2014 9:29 pm
Forum: Volume 100 (10000-10099)
Topic: 10018 - Reverse and Add
Replies: 169
Views: 17762

Re: 10018 - Reverse and Add

You must check input in this thread first. (..) This is statement is wrong. My AC program produces: Input 2 2 99 Output 0 2 0 99 So it seems that the statement "If n is already pallindrome, output is 0 n" (which Shahidul.CSE may have inferred from previous test cases posted in these forums) is not ...

Go to advanced search