Re: [gcj] Arrrggggghhhh
My Accepted Program shows that Case #15: 0.6875 Case #24: 0.6875 On 2013/5/5 2:33, zach polansky wrote: Can someone tell me what is wrong??? Input: 100 20 -2 4 3 -2 0 12 0 0 14 4 0 18 2 0 10 -4 0 5 0 2 16 0 0 18 0 4 11 0 0 17 0 2 15 4 0 6 -1 1 6 -2 2 10 3 1 5 0 2 1 0 682 10 2 2 5 9996 0 12 2 0 14 -1 3 4 1637 3881 5 0 4 10 3 1 5 -2 0 10 2 2 6 4 0 16 1747 2953 16 -6 0 14 1379 9755 1 0 2 16 -4 0 14 0 0 13 -3 1 11 -4 0 11 0 2 19 -3 3 1 2 0 12 1498 654 17 -6 0 8 -3 1 7 4 0 19 -3 3 5 -4 0 14 -7518 0 15 2 0 20 3 3 1 1 1 3 2 0 19 -1 3 11 -1 3 5 -1 1 15 -6 0 1 0 0 3 0 0 6 3 1 1 4 2 10 2 0 6 -4 0 13 4807 7785 17 -2 2 18 2 0 3 2 0 20 1 3 20 8552 6720 1 0 2 17 2952 0 19 0 2 13 0 0 5 0 4 20 1 3 11 0 0 16 2 2 3 2 0 3 2 0 9 3550 3712 4 1 1 11 -1 3 18 -5 1 8 1 3 7 0 6592 4 -1574 0 2 1290 8780 11 2 2 1 0 0 1 -1 1 15 196 0 20 1559 2717 6 0 2 20 4 0 9 0 0 4 2 0 18 6 0 11 1 3 6 7311 7835 5 4 0 2 2 0 16 2 2 1 0 2 5 0 2 My output: Case #1: 0.03125 Case #2: 0.75 Case #3: 1.0 Case #4: 1.0 Case #5: 1.0 Case #6: 0.9375 Case #7: 0.0 Case #8: 1.0 Case #9: 1.0 Case #10: 1.0 Case #11: 1.0 Case #12: 1.0 Case #13: 1.0 Case #14: 0.0 Case #15: 0.625 Case #16: 0.0 Case #17: 0.0 Case #18: 0.3125 Case #19: 0.0 Case #20: 1.0 Case #21: 1.0 Case #22: 0.0 Case #23: 0.0 Case #24: 0.625 Case #25: 1.0 Case #26: 0.3125 Case #27: 0.0 Case #28: 0.0 Case #29: 0.5 Case #30: 0.0 Case #31: 0.0 Case #32: 1.0 Case #33: 1.0 Case #34: 1.0 Case #35: 1.0 Case #36: 1.0 Case #37: 0.0625 Case #38: 0.0 Case #39: 0.0 Case #40: 0.75 Case #41: 0.25 Case #42: 0.5 Case #43: 0.0625 Case #44: 0.0 Case #45: 0.0 Case #46: 1.0 Case #47: 0.1875 Case #48: 0.0 Case #49: 0.75 Case #50: 1.0 Case #51: 0.1875 Case #52: 1.0 Case #53: 0.0 Case #54: 1.0 Case #55: 1.0 Case #56: 0.0 Case #57: 0.0 Case #58: 1.0 Case #59: 0.0 Case #60: 0.0 Case #61: 1.0 Case #62: 1.0 Case #63: 0.75 Case #64: 1.0 Case #65: 0.0 Case #66: 0.0 Case #67: 0.0 Case #68: 1.0 Case #69: 1.0 Case #70: 0.0 Case #71: 1.0 Case #72: 1.0 Case #73: 1.0 Case #74: 0.75 Case #75: 0.75 Case #76: 0.0 Case #77: 0.5 Case #78: 0.1875 Case #79: 0.5 Case #80: 0.0 Case #81: 0.0 Case #82: 0.0 Case #83: 0.0 Case #84: 0.5 Case #85: 1.0 Case #86: 0.0 Case #87: 0.0 Case #88: 0.0 Case #89: 1.0 Case #90: 1.0 Case #91: 1.0 Case #92: 1.0 Case #93: 0.875 Case #94: 0.1875 Case #95: 0.0 Case #96: 0.0 Case #97: 0.5 Case #98: 1.0 Case #99: 0.0 Case #100: 0.0 -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To post to this group, send email to google-code@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] Whats the way I should write the code?
I think you can use System.setIn(new FileInputStream(code_jam_input_file.txt)); System.setOut(new PrintStream(code_jam_output_file.txt)); These two line should let you read from txt file and write to a txt file. Parker On 2013/3/30 21:37, Chandra Sekhar wrote: Hi All, I am going to participate Google Code JAM 2013. So before that I thought to practice a bit. I found the inputs are given in a file and the output is expected in a file only. So my question is do I need to write some IO operations to read the question from file and after calculating the output do I again need to write that back to another destination file through code. Or I can copy the the input file contents to my code and just write the code and after getting the output in the console, I can copy the output to a file to send as output file. For Example: the input of a contest 3 100 3 5 75 25 Can I write the code like int index = 3, credit = 100, noOfProducts = 3; int[] prices = {5,75,25}; //Code to calculate output starts here System.out.print(output); //After getting the output into console copy it into a file and send it as an output file. Or I need to write like this FileInputStream fis = new FileInputStream(code_jam_input_file.txt); //read the input file and parse the content and then start calculating the output //After getting the output write back it to a destination output file and then send it to Google. Thanks. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To post to this group, send email to google-code@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/google-code/-/867rZfbqOKgJ. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To unsubscribe from this group and stop receiving emails from it, send an email to google-code+unsubscr...@googlegroups.com. To post to this group, send email to google-code@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] 15 - Shortest Path, 440 - Tortoise's Shortest Path
Hey, you forgot to clear Weight[i] for different test case before pushing new edges for new cities ! ! :) and FastIO is not needed. Parker On 2012/12/23 11:25, thefourtheye dIVi wrote: Hi, I think this is one of the simple problems which would have got a lot TLEs. This is what I do, http://ideone.com/7XE0UU My actual starts at Line 228. It TLE's in https://www.spoj.com/problems/SHPATH/ whereas it WA's in http://www.spoj.com/problems/TSHPATH/ (which is same as the SHPATH problem with 60 sec Time limit) Could anyone please help me with this? -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] SPOJ - ONEZERO - WA :(
Bignumber operation can be avoid, but you should not use unsigned long long anyway. http://ideone.com/3nlO2d Above is another accepted solution, the idea is still BFS, but without BigInteger. Parker On 2012/12/19 22:14, thefourtheye dIVi wrote: Hi Parker, Thanks for the Suggestion... I am new to the Big Integer stuff, so working on it... Moreover, http://www.spoj.com/forum/viewtopic.php?f=3t=3555p=19155 This thread has a solution similar to what I have implemented but no one replied in the thread was worried about the Big Integer, so might it be a bug in my implementation which gets me WA? But 19998 is a very valid input... :( On Mon, Dec 17, 2012 at 3:40 AM, ZHANG Xiongqi, Parker zhangxion...@gmail.com mailto:zhangxion...@gmail.com wrote: Hi thefourtheye dIVi, Basically your idea is correct and this problem can be solved using BFS. However, it is not sufficient to use unsigned long long to solve this problem because the answer to 19998 is 0 which is much larger than the maximum number that could be represented using unsigned long long. One more thing to note, you can keep track of all the possible remainder and no need to process the remainder that has appeared before. The reason for that is left for your exercise. :) Here is the accepted code which I adapted from yours. http://ideone.com/7ziUxy If you have any more questions, fell free to ask. Parker On 2012/12/16 22:42, thefourtheye dIVi wrote: I am trying to solve http://www.spoj.com/problems/ONEZERO/ I referred so many internet posts about this, and they all talk about storing reminders and building a tree. I am running a simple BFS, nothing else... But this gets me WA :( http://ideone.com/SZDn5T Dont know whats wrong with this code. Please help me fix it. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com mailto:google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com mailto:google-code%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com mailto:google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com mailto:google-code%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] SPOJ - ONEZERO - WA :(
Hi thefourtheye dIVi, Basically your idea is correct and this problem can be solved using BFS. However, it is not sufficient to use unsigned long long to solve this problem because the answer to 19998 is 0 which is much larger than the maximum number that could be represented using unsigned long long. One more thing to note, you can keep track of all the possible remainder and no need to process the remainder that has appeared before. The reason for that is left for your exercise. :) Here is the accepted code which I adapted from yours. http://ideone.com/7ziUxy If you have any more questions, fell free to ask. Parker On 2012/12/16 22:42, thefourtheye dIVi wrote: I am trying to solve http://www.spoj.com/problems/ONEZERO/ I referred so many internet posts about this, and they all talk about storing reminders and building a tree. I am running a simple BFS, nothing else... But this gets me WA :( http://ideone.com/SZDn5T Dont know whats wrong with this code. Please help me fix it. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] optimized algo for LCS0
The concatenating of list(si) would have a size of O(mn) at worst case and even the O(n logn) algorithm for solving the longest increasing subsequence will not be fast enough. Please tell me I am wrong. =w= Parker On 2012/12/17 9:28, Luís Fernando Dorelli de Abreu wrote: Given the limits, those ideas are going to TLE I guess. You can get an idea of a reduction that might work here : http://www.cs.ucf.edu/courses/cap5510/fall2009/SeqAlign/LCS.efficient.pdf 2012/12/16 Faisal Dirie vranz...@gmail.com mailto:vranz...@gmail.com Use brute-force methods to devise an algorithm, then and then, use dynamic programming techniques to tweak your code to achieve an optimized one, depending on what you want to do. On Sun, Dec 16, 2012 at 6:20 PM, Faisal Dirie vranz...@gmail.com mailto:vranz...@gmail.com wrote: Check the links below. http://www.cc.gatech.edu/~ninamf/Algos11/lectures/lect0311.pdf http://www.cc.gatech.edu/%7Eninamf/Algos11/lectures/lect0311.pdf http://en.wikibooks.org/wiki/Algorithm_implementation/Strings/Longest_common_subsequence -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com mailto:google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com mailto:google-code%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] 439 - Knight Moves - UVa - WA
Agree with Neal To read till the end of file, I would suggest to use while (cin str1 str2) { .. } and then there is no need to take care of the last 'endl'. the following code give me accepted. http://ideone.com/ORzXcK Parker On 2012/12/13 13:34, Neal Zane wrote: Not sure but could be the last 'endl' for the last line you intentionally avoided. Note that UVa reports WA on mis-formatting, insteadof PE (long ago since host migration). The while loop judging cin.eof() could also fail it if the input file has extra lines that althoughthe test cases are read but in the tail there are some blanks, cin.eof() is true and you are still running and the output could be corrupted.It's safer to use just: while (cin str1 str2) { .. } The code logic looks fine to me(hard to tell though, UVa is lining up judging queuefor now.) Regards On Thu, Dec 13, 2012 at 11:55 AM, thefourtheye dIVi thechargingvolc...@gmail.com mailto:thechargingvolc...@gmail.com wrote: Hi, I believe it is a very simple problem but still getting WA... :( Could you anyone please help me spotting the mistake? http://ideone.com/dAsYdK -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com mailto:google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com mailto:google-code%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- 8-) -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] Timus - 1119 - Metro
Basically, you have a wrong comparator for the sort function. /*** int cmp (point item1, point item2) { if (item1.x == item2.x) { return (item1.y = item2.y); } return item1.x item2.x; } ***/ This is what you truly need. Parker On 2012/12/5 14:36, thefourtheye dIVi wrote: I am not sure why my code fails at Test case number 6. Please help me at the earliest. http://acm.timus.ru/problem.aspx?space=1num=1119 And this is the code which I submitted http://ideone.com/YZX5iO -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] Compilation error for submission (ACM-ICPC Live Archive)
To Amir Hossein Sharifzadeh, You should always name your class as Main (case sensitive, not main or MAIN) as online judge will put your code into the file named Main.java i.e. you should write the following class public class Main { } Parker On 2012/12/6 5:50, Morgan Bauer wrote: Exactly what it says? Your file is named Main.java, and the compiler want's it to be named Bartjens.java. ~mhb On Wed, Dec 5, 2012 at 3:38 PM, Amir Hossein Sharifzadeh amirsharifza...@gmail.com wrote: Is there anyone who has submitted problems in uva onlinejudge or ACM-ICPC Live Archive? I wrote a problem of the ACM ICPC World finals in Java without any problem. But I frequently receive the following error: Compilation error for submission Main.java:9: class Bartjens is public, should be declared in a file named Bartjens.java public class Bartjens { ^ 1 error -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [gcj] Re: T-shirt has already sent?
same here. I still have not received. 2012/10/27 Luís Fernando Dorelli de Abreu lfdore...@gmail.com mailto:lfdore...@gmail.com Is it only me or there is someone else who still haven't got the T-shirt? 2012/9/19 Bartholomew Furrow fur...@gmail.com mailto:fur...@gmail.com - It doesn't matter if you're under 18 for purposes of t-shirts. - If you haven't gotten yours by the end of October, please let us know at code...@google.com mailto:code...@google.com. We definitely want to make sure everyone gets his or hers! -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com mailto:google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com mailto:google-code%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com mailto:google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com mailto:google-code%2bunsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Code Jam group. To post to this group, send email to google-code@googlegroups.com. To unsubscribe from this group, send email to google-code+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.