Getting output 0 0

problem

my solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
int num{};
int w{};
int L{},temp{};
vector lead{};
cin>>num;
while(num–)
{
int s1{},s2{},temp{};
cin>>s1>>s2;

  lead.push_back(s1-s2);

}
for(int i=0 ; i<lead.size() ; i++)
{
if(lead.at(i)<0)
{
temp=lead.at(i)*(-1);
}
else
temp=lead.at(i);
if(temp>L)
{
L=temp;
if(lead.at(i)<0)
w=2;
else
w=1;
}
}
cout<<w<<" "<<L;

return 0;
}

when i use custom input given in the problem i get correct answer
but when i run without custom input i get output 0 0
i dont understand.

New to Codechef. Can't understand the platform :slight_smile:

2 Likes

when i submit it , it shows wrong answer

Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

2 Likes

https://www.codechef.com/viewsolution/37020757 link to submission

1 Like
1 Like

2 34

1 Like

ooook
thank you so much for the help

1 Like