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.
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
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
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
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*
*
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
>
> 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:
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
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
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
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
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
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;
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
#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) %
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
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
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
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 -
19 matches
Mail list logo