I have query with my solution in august cook ,coke

#include
#include 
#include 
#include 
using namespace __gnu_pbds;
using namespace std;
#define i insert
#define pb push_back
#define pp pop_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define LL long long
#define M 10000000007LL
#define c cin
#define o cout
typedef map mii;
typedef pair pii;
typedef vector v;
typedef tree<int, null_type, less, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
#define fast  ios_base::sync_with_stdio(false),cin.tie(NULL);
int main()
{
    fast;
   int t;
   cin>>t;
   while(t--)
   {
       LL n,m,k,l,r;
      
       cin>>n>>m>>k>>l>>r;
        LL A[n],B[n];
       for(int i=0;i>A[i];
           cin>>B[i];
       }
       for(int i=0;i<n;i++)
       {
          for(int j=0;jk+1)
           {
               A[i]-=1;
             
           }
           if(A[i]=k+1 && A[i]<=k-1 )
           {
               A[i]=k;
           }
          }
       }
   
        LL y=987455;
       for(int i=0;i=l && A[i]<=r)
           {
              
               y=min(B[i],y);
             
           }
       }
       if(y>0 && y!=987455)
       {
       cout<<y<<endl;
       }
       else
         cout<<-1<<endl;
       
      
       
   }

}

Please specify your query properly ?

#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
#define tc int t ;cin>>t ;while(t--)
#define pb push_back
#define FOR(i,y) for(int i =0;i<y;i++)
#define Sort(v) sort(v.begin() ,v.end())
int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0) ; cout.tie(0) ;
    tc
    {
      ll n,m,k,l,r ;
      cin>>n>>m>>k>>l>>r ;
      ll z = 1000010 ;
      ll c , p ;
      ll tfinal = 0 ;
      FOR(i,n)
      {
        cin>>c >> p ;
        tfinal = c ;
        for(int j =0;j<m;j++)
        {
          if(tfinal<=k+1 && tfinal>=k-1 )
            { tfinal = k ;
              break ; }
          else if(tfinal>k+1 )
            tfinal-- ;
          else if (tfinal<k+1)
              tfinal ++ ;

        }
        if(tfinal>=l && tfinal<=r)
        z = min(z , p) ;
      }
      if(z<1000010)
      cout<< z <<"\n" ;
      else
      cout<<"-1" <<"\n" ;

    }


	return 0;
}

//This might help you

The price of a coke can go as high as 10^6. So you should have taken the value of y as 10^6 +1 .

1 Like

It give a wrong a answer but i am unable to find the solustion where i am wrong in my program

What is this ?:thinking::thinking:

this one also temp should belong to temp>=k-1 && temp<=k+1 this will be the condition
One kind suggestion read ques again properly .

indent preformatted text by 4 spaces

By mistake the greater than symbol got omitted
this one is original code

#include
#include 
#include 
#include 
using namespace __gnu_pbds;
using namespace std;
#define i insert
#define pb push_back
#define pp pop_back
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define LL long long
#define M 10000000007LL
#define c cin
#define o cout
typedef map mii;
typedef pair pii;
typedef vector v;
typedef tree<int, null_type, less, rb_tree_tag,
             tree_order_statistics_node_update>
    new_data_set;
#define fast  ios_base::sync_with_stdio(false),cin.tie(NULL);
int main()
{
    fast;
   int t;
   cin>>t;
   while(t--)
   {
       LL n,m,k,l,r;
      
       cin>>n>>m>>k>>l>>r;
        LL A[n],B[n];
       for(int i=0;i>A[i];
           cin>>B[i];
       }
       for(int i=0;i<n;i++)
       {
          for(int j=0;jk+1)
           {
               A[i]-=1;
             
           }
           if(A[i]=k+1 && A[i]<=k-1 )
           {
               A[i]=k;
           }
          }
       }
   
        LL y=987455;
       for(int i=0;i=l && A[i]<=r)
           {
              
               y=min(B[i],y);
             
           }
       }
       if(y>0 && y!=987455)
       {
       cout<<y<<endl;
       }
       else
         cout<<-1<<endl;
       
      
       
   }

}

sir due to html syntax it taken by their own

tried
same output
wrong answer

i have written same
due to html it takes wrong

a few symbols are missing…
for(int j=0;jk+1)
i hope this is not in actual submission
https://www.codechef.com/viewsolution/25992170
here’s my solution
we have similar approach

please can you go throuh it

This is my link (https://www.codechef.com/viewsolution/26012361)

Click on the this is my link

suppose there is only one valid coke and it has price 10^6 . check with your code .

that also i have tried

Send the link to your solution .

https://www.codechef.com/submit/COKE#

i just stuck . where i am wrong please help

that is not the link to your solution . go to the problem . click on “my submissions” and then send the link to your latest solution .

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