My solution : https://www.codechef.com/viewsolution/29170163

The link to question is https://www.codechef.com/LTIME80B/problems/BFRIEND/

My solution : https://www.codechef.com/viewsolution/29170163

The link to question is https://www.codechef.com/LTIME80B/problems/BFRIEND/

Let us consider the following scenario when the input is

1

2 5 3 2

1 6

Over here, the best solution would be to go from 3 to 6, then change and then go from 6 to 5 which would take a total time of 6 minutes. But the output of your solution is 8. Try debugging it. Thanks.

1 Like

Thank you!!

got my logical error …i was optimizing the nearest floor but was missing the part of Alice’s floor

1 Like

WHY DID THIS SOLUTION FOR https://www.codechef.com/LTIME80B/problems/STFOOD GET WA ?

#include

using namespace std;

int main() {

int t;

cin>>t;

while(t–)

{

int n,maxi=0;

cin>>n;

while(n–) {

int s,v,p,x;

cin>>s>>v>>p;

x=(p/(s+1))*v;

if(x>maxi)

maxi=x;

}

cout<<maxi<<endl;

}

return 0;

}

cin >> s >> p >> v;

1 Like

Overlooked the Input section My bad. Thanks !

1 Like