[gcj] Re: Round 1B 2020 Expogo - WA For Test Set 3

2020-04-21 Thread Matt Fenlon
Hi Bob! The WA is, in part, related to the limits of the problem (-10^9 to 10^9) and variable types. The limits for Test Set 3 are overflowing the ints in the program. We have to use long long for cases as large as these. However, after switching up all the necessary types, I still see a WA.

Re: [gcj] Re: What's my mistake? - [Round 1B - 2020 : Expogo]

2020-04-21 Thread Matt Fenlon
I agree. There is a way to incorporate all of those "base cases" into the loop in such a way that the loop not only handles the more complex problems, but the simple ones as well. On Tuesday, April 21, 2020 at 12:39:15 PM UTC-4, Atif Hussain wrote: > > Rohan, you should never hard code so many

[gcj] Round 1B 2020 Expogo - WA For Test Set 3

2020-04-21 Thread Bob Shepard
I've been looking at other submissions and even ran 100 random coordinates between (-10^9, -10^9) and (10^9, 10^9), but I get the same results as those that passed. I'm not sure why my solution got a WA for test set 3, maybe I'm missing an edge case. I think what I did is similar to what the

[gcj] Re: Please point out the mistake. [Round 1B - 2020 : Expogo]

2020-04-21 Thread Matt Fenlon
Hi Abhishek! Two things: {string a = rec(a, abs(x), abs(y));} This line here is causing a Segmentation Fault. In C++, when we declare variables in any way that does not use the default constructor (in this case, the copy constructor), the lifetime of a variable does not begin until

[gcj] Re: WA- - GCJ'19 ROUND 1C - Robot Programming Strategy

2020-04-21 Thread porker2008
When it is Scissor and Paper, you should swap al[0] and al[1], assuming al[0] always beat al[1] *T = int(input())* *t = 1* *cas = ["P","R","S"]* *while(t <= T):* *res = ""* *A = int(input())* *l = []* *for i in range(A):* *l.append(input())* *pos = 0* *

Re: [gcj] Re: 2020 1B P1 Expogo: solution using bitwise operations. (fails with WA though). Am I wrong with the approach or is just a bug in code?

2020-04-21 Thread Aditya Vikram Jain
Hi Alexander, I used similar approach and I think I found out why it is wrong, basically the solution just assumes that we need to convert the solution into two numbers which on xored give 0 and and the or operation between the two gives 2^(n-1), but this approach marks many possible answers

[gcj] Re: 2020 1B P1 Expogo: solution using bitwise operations. (fails with WA though). Am I wrong with the approach or is just a bug in code?

2020-04-21 Thread Alexander Iskhakov
> > Quickly refactored the code: > import java.io.{BufferedReader, BufferedWriter, InputStreamReader, OutputStreamWriter} import java.util.Scanner object Solution { private def isPowerOf2(x: Long) = (x & (x - 1L)) == 0L /** * returns next power of 2 greater then x. * Example:

Re: [gcj] 2020 1B P1 Expogo: solution using bitwise operations. (fails with WA though). Am I wrong with the approach or is just a bug in code?

2020-04-21 Thread mattfenlon2
Hi Alexander! I attempted a similar approach without success. How does your program handle cases such as 1 4 and -1 4? Both have valid solutions: SNE and NSE. Best, Matt > On Apr 21, 2020, at 1:22 PM, Alexander Iskhakov > wrote: > >  > Submission returns "WA", and it doesn't provide the

Re: [gcj] 2020 1B P1 Expogo: solution using bitwise operations. (fails with WA though). Am I wrong with the approach or is just a bug in code?

2020-04-21 Thread Atif Hussain
Overall idea seems fine, but transformation logic seems incomplete. You haven't computed it recursively. Submission returns "WA", and it doesn't provide the example on which it failed. It's a known difficulty with CodeJam problems. As you ignored recursion, finding bugs should be easy. Try

[gcj] 2020 1B P1 Expogo: solution using bitwise operations. (fails with WA though). Am I wrong with the approach or is just a bug in code?

2020-04-21 Thread Alexander Iskhakov
Submission returns "WA", and it doesn't provide the example on which it failed. Cannot find a bug: tried lots of my examples, all work. We immediately reduce the problem to considering both inputs as positive (if negative we use Abs() and just remember which one or both during reading, and

Re: [gcj] Re: What's my mistake? - [Round 1B - 2020 : Expogo]

2020-04-21 Thread Atif Hussain
Rohan, you should never hard code so many results. They are error prone. Not in real life code, not in competitions. Regards, Atif Tue, 21 Apr, 2020, 9:51 PM Rohan Shukla, wrote: > Thanks Matt. > > I completely messed up the directions. > The loop logic was right. It was the directions. > Made

Re: [gcj] Re: CodeJam 2020 Round 1B - 3.JoinTheRanks - WA for my submission

2020-04-21 Thread Atif Hussain
Thanks. On Tue, 21 Apr, 2020, 9:51 PM PAGADALA SAINADTH, wrote: > your code does found the optimal solution though it sorts by ranks. > Eg: > your output > 1 > 3 3 > Case #1: 4 > 6 2 > 5 2 > 4 1 > 3 1 > optimal solution would be > 1 > 3 3 > Case #1: 3 > 2 5 > 2 2 > 3 5 > > > > On Monday, April

[gcj] [JAVA][Pascal Triangle] MLE

2020-04-21 Thread Quentin
Hello all, I am facing MLE with the pascal triangle last test case but I do not understand what is the cause of that. import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Scanner; import java.util.stream.Collectors;

[gcj] Re: Expogo BFS solution corner case

2020-04-21 Thread Cheung Scott
Thank you very much, this do help. I just realize that straightforward BFS doesn't work for such scenario where each step is not at a fixed distance. 在 2020年4月21日星期二 UTC+8上午6:05:54,Matt Fenlon写道: > > -4 -1 is outputting IMPOSSIBLE when a possible path is NSW. As a matter of > fact, all

[gcj] Please point out the mistake. [Round 1B - 2020 : Expogo]

2020-04-21 Thread Abhishek Mohanty
#include using namespace std; string rec(string ans, int x, int y){ if(x + y == 0){ return ""; } if(x == 1 && y == 0) return ans + 'E'; if(x == -1 && y == 0) return ans + 'W'; if(x == 0 && y == 1) return ans + 'N'; if(x == 0 && y == -1) return ans + 'S'; if(x % 2 == 0){ ify + 1) + x) / 2) %

[gcj] [JAVA]Pattern Matching: WA for Test Set 2

2020-04-21 Thread Quentin
Hello, I get stuck with the test set 2 and I can't find where the issue is since I do manage to get wrong answer on my laptop. Here is me code : import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Solution { private static final char WILDCARE = '*'; public

[gcj] Re: Round 1b 2020 BUS routes problem

2020-04-21 Thread D A Mahesh
Thank you for your response On Monday, April 20, 2020 at 11:52:41 PM UTC+5:30, porker2008 wrote: > > Your approach is wrong IMO. > > Please checkout the analysis and try to understand the intended solution. > -- You received this message because you are subscribed to the Google Groups "Google

[gcj] Re: What's my mistake? - [Round 1B - 2020 : Expogo]

2020-04-21 Thread Rohan Shukla
Thanks Matt. I completely messed up the directions. The loop logic was right. It was the directions. Made the necessary changes, it passed all test cases. Thanks! On Tuesday, April 21, 2020 at 4:05:31 AM UTC+5:30, Matt Fenlon wrote: > > Some of the hardcoded conditions/appends are out of

[gcj] Re: CodeJam 2020 Round 1B - 3.JoinTheRanks - WA for my submission

2020-04-21 Thread PAGADALA SAINADTH
your code does found the optimal solution though it sorts by ranks. Eg: your output 1 3 3 Case #1: 4 6 2 5 2 4 1 3 1 optimal solution would be 1 3 3 Case #1: 3 2 5 2 2 3 5 On Monday, April 20, 2020 at 10:08:09 PM UTC+5:30, Atif Hussain wrote: > > Hi, > For Google CodeJam 2020 Round 1B -