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- CodeChef: Practical coding for everyone

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 ā€¦:stuck_out_tongue:

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 CodeChef: Practical coding for everyone

Can anyone help me with my code CodeChef: Practical coding for everyone . Getting wrong answer

My Java implementation is giving me wrong answer although itā€™s working on eclipse. CodeChef: Practical coding for everyone
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[i];
    }

    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[i]==a[i-1])
        {
            p=p*a[i];
            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?

2 Likes

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