STICKS - Editorial

https://www.codechef.com/viewsolution/10644839 Can someone explain why am i getting WA

Can somebody please tell me at what test i got wrong answer
https://www.codechef.com/viewsolution/10647330

Please can anyone point out the error in my code- https://www.codechef.com/viewsolution/10793814

https://www.codechef.com/viewsolution/10864425

I am getting the required output, but its saying wrong answer :frowning:

https://www.codechef.com/viewsolution/10867659

Java Code: I am getting wrong answer for this, while its running perfectly on local compiler.

Yes i have taken some extra boolean flags ..:P

https://www.codechef.com/viewsolution/10867659

Java code: I am getting WA, but its running perfectly on my system.

ye I have taken few extra boolean flags :stuck_out_tongue:

As usual,although I have passed the given test cases,I cant seem to find the reason why my code is getting a WA!

Here’s the link to the code:-

http://pastebin.com/NbKdECcb

Please somebody help me, I am getting WA https://www.codechef.com/viewsolution/10935149

Can anyone help me with my code https://www.codechef.com/viewsolution/11238582 . Getting wrong answer

My Java implementation is giving me wrong answer although it’s working on eclipse. https://www.codechef.com/viewsolution/11248379
Please help!

can anyone say me what is wrong with my output??
or which case did i miss
https://www.codechef.com/viewsolution/13211673

C code
Can any one say me what is wrong with the code…
its working fine in code blocks…but am getting wrong answer warning while submitting.
could anyone please explain??
here is the link
https://www.codechef.com/submit/complete/13211715

C code
Can any one say me what is wrong with the code…
its working fine in code blocks…but am getting wrong answer warning while submitting.
could anyone please explain??
here is the link
https://www.codechef.com/submit/complete/13211715

Iam getting WA.But it is working fine in code blocks
https://www.codechef.com/viewsolution/13211715
could anyone explain pls

for (int i = 0; i < t; i++) {
br.readLine();
toks = br.readLine().trim().split(" ");
int[] A = new int[toks.length];
for(int j=0; j<toks.length; j++){
A[j] = Integer.parseInt(toks[j]);
}
Arrays.sort(A);
int found = 0;
int ans = 1;
for(int x=A.length-1; x>0; x–){
if(A[x] == A[x-1]){
ans = ans * A[x];
found = found + 2;
x–;
}
if(found == 4){
break;
}
}
System.out.println(found == 4 ? ans : -1);

Hello, I’m trying to understand why this solution is returning a wrong answer.

https://www.codechef.com/viewsolution/18760432

Any feedback would be greatly appreciated :slight_smile:

One thing to note is the question is to find the maximum area of one rectangle. I was taking the maximum possible area of all the rectangles (i.e summing all the areas ).
for example the test case :
8
1 1 1 1 1 1 1 1
output should be 1 not 2 :slight_smile:

This is my implementation. How is it?
#include<bits/stdc++.h>
using namespace std;

int main()
{
int t;
cin>>t;

while(t--)
{
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a*;
    }

    sort(a,a+n);
    int ans=-1;
    int p=1,cnt=0;
    for(int i=n-1;i>=0;i--)
    {
        if(cnt==2)
        {
            break;
        }

        if(a*==a[i-1])
        {
            p=p*a*;
            i--;
            cnt++;
        }
    }

    if(cnt==2)
    {
        cout<<p<<endl;
    }
    else
        cout<<ans<<endl;
}
return 0;

}

@admin , a stupid question, but is making squares allowed with any left over pair of sticks?

Can anyone tell which test case is failed for my code or why I’m getting Wrong Answer
https://www.codechef.com/viewsolution/22156698