What was the input in task#1?
My initial solution was :
b = y
c = b+1
a = 3x - b - c
it didn’t pass.
Then took:
a = -600
b = y and
c = 3x - a - b
and it passed the testcases.
What was the input in task#1?
My initial solution was :
b = y
c = b+1
a = 3x - b - c
it didn’t pass.
Then took:
a = -600
b = y and
c = 3x - a - b
and it passed the testcases.
I think you’ve misunderstood the definition of median a bit.
The median is defined for any set of integers, irrespective of whether they are sorted or not. The median of \{1, 2, 3\}, \{2, 3, 1\}, \{3, 1, 2\} is all 2, because in each of those sets, 2 is the middle number if you write its elements in sorted order.
So, you don’t really need to print the numbers in sorted order.
Consider a case like y = 0 and x = 100. Your initial solution computes
b = 0
c = 1
a = 299
The median of this set isn’t 0.
https://www.codechef.com/viewsolution/73432127
Here is my solution.
I don’t understand why i get wa. Can anyone please explain what’s wrong in my solution?
can u please tell me why I am getting WA
here is my solution
Check for mean=2,median=1, your output is 3,1,2 and the median of your output is 2 and not 1
oh ok now i got it thanks
https://www.codechef.com/viewsolution/73442869
It is printing correct output for every test case still i am getting WA.
I dont know python but i can take a guess:
Take mean =1, median=2
Your output is [0,2,1] whose median is 1 and not 2
Ill give you a test case
X=0 and y=-100
Your output is [0,-100,100] whose median is 0 and not -100
Take this test case
N=0, m=-100
Your output:[0,-100,100]
the median of your output is 0 and not -100
why isn’t this working???
t=int(input())
for _ in range(t):
x,y=map(int,input().split())
if ((3x)-y)%2==0:
f=t=((3x)-y)/2
else:
f=int(((3x)-y)/2)
t=(3x)-y-f
print(int(f),int(y),int(t))
I see . Thanks
thank you
Some test cases are not being able to pass :
here is the code:
int main() {
int t;
cin>>t;
while(t>0){
int x;
int y;
cin>>x>>y;
if(x<=100&&x>=-100&&y<=100&&y>=-100){
int a,b,c;
if(x==y){
a=x;
b=x;
c=x;;
cout<<a<<" “<<b<<” “<<c<<endl;
}
else if(y<0)
{
b=y;
c=0;
a=3x-b;
cout<<a<<" “<<b<<” "<<c<<endl;
}
else
{
a=0;
b=y;
c=3x-b;
cout<<a<<” “<<b<<” "<<c<<endl;
}
}
t–;
}
return 0;
}
Why this one is wrong can some one explain?
ll t;cin>>t; while(t--){ ll x,y; cin>>x>>y; if(y>0){ int a=0, b = y, c=3*x -y; cout<<a<<" "<<b<<" "<<c<<endl; } else if(y<0){ int a=3*x+y, b = y, c=0; cout<<a<<" "<<b<<" "<<c<<endl; } else if(y==0){ int a=3*x-1, b = y, c=3*x - a; cout<<a<<" "<<b<<" "<<c<<endl; } } return 0;}
what is y==0
https://www.codechef.com/viewsolution/73490455
Can anyone tell me whats wrong in this logic…Why is it getting WA?
What’s wrong in this solution?
#include
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t–){
int x,y;
cin>>x>>y;
cout<<0<<" "<<y<<" "<<(3*x - y)<<" "<<endl;
}
return 0;
}