"I want to ask a question" - Ask them all here!

Is there any Bangladeshi here? I want to build a team. Please reply @diponsaha007

Piece of coronavirus :joy: :rofl: :rofl: :rofl: :rofl:

https://www.codechef.com/viewsolution/30420213
My code is working fine and giving the expected output on my desktop, but codechef is showing wrong answer, please help.

Sir there is a bug in the checker of the April Long Challenge in the question UNITGCD.
It is running in linear time and still showing TLE .Please review this question as I am not able to find any problem in my solution.Please help

HERE

import math
def breakegg(floors,mid_floor,first_floor,count):
if floors%2!=0:
if mid_floor!=first_floor:
mid_floor=math.ceil(mid_floor/2)
count+=1
breakegg(floors,mid_floor,first_floor,count)
else:
print(count+1)

else:
    if mid_floor!=floors:
        first_floor=mid_floor
        mid_floor=round(floors+mid_floor/2)
        count+=1
        breakegg(floors,mid_floor,first_floor,count)
    else:
        print(count+1)

test_cases=int(input())
while test_cases>0:
test_cases-=1
floors=int(input())
if floors%2==0:
mid_floor=floors/2
else:
mid_floor=(floors+1)/2
first_floor=1
count=0
breakegg(floors,mid_floor,first_floor,count)


Question: sir, why this code is showing nzec error sir?

this is for the egg problem , codechef.

In Questions with multiple test case usually there is like - “sum of inputs(n) over all test cases is <= x”. If this line is not given in question then can we assume that the “sum of inputs” over all test cases will be less than the max constraint value of input(n)?

Hi guys I need help
I was doing a knapsack problem and Im getting runtime error it works fine on the test cases
problem link: KNPSK Problem - CodeChef
my solution link : CodeChef: Practical coding for everyone
Pls help me

I have also encountered some question were we need to check for constrain other wise it’s gives WA why?

you are not supposed to post your code before contest is over ! Remove it

1 Like

Hi, I am new to CodeChef and Wanted to understand what is meant by WA mean?

Sub-Task Task # Result
(time)
1 0 WA
(0.110000)
Subtask Score: 0.00% Result - WA
2 1 WA
(0.350000)
Subtask Score: 0.00% Result - WA
Total Score = 0.00%

The number of submissions that one can make during the contest on the problem will be limited to 500 and the maximum number of submissions allowed in the challenge problem are limited to 100.

Does this mean that the total no of solutions I can submit on all the problems in an ongoing codechef long challenge is 100? Or is the limit 100 solutions per problem?

Wrong Answer

100 solutions per problem
(i did it on one, xD)

You can not discuss

Help me in ZC012001 matched brackets in DSA week 2

n = int(input())
a = list(map(int, input().split()))
b = []
c = 0
d = []
e = []
g = []
for i in range(len(a)):
    if(a[i] == 1):
        b.append(a[i])
        c += 1
    else:
        if(len(b) == 0):
            break
        else:
            d.append(len(b))
            b.pop()
            c -= 1
            g.append(i)
            if(len(b) == 0):
                e.append(i+1)
#print(b)
#print(d)
#print(e)
#print(g)
h = max(d)
for i in range(len(d)):
    if(d[i] == h):
        j = i
        break
k = g[j]
m = 0
for i in range(len(e)-1):
    if(m < abs(e[i+1] - e[i])):
        m = abs(e[i+1] - e[i])
        p = e[i] + 1
print(h, k, m, p)

sir i was not aware of moss as i am new here so just for fun i created my two id on codechef and submitted exactly same solution on both of my id those are priyanshu_x and ash56_ash so what can i do delete both id and start a new one or delete either of them

plz sir reply asap

can any help me why i am segmentation fault here?
#include <bits/stdc++.h>
using namespace std;

int main() {
int n,k,sum_=0;
cin>>n>>k;
vector v;
for(int i=0;i<n;i++){
cin>>v[i];
sum_+=v[i];
}
int x=k-sum_;
int min1=(*min(v.begin(),v.end()));
int max1=(*max(v.begin(),v.end()));
if((find(v.begin(),v.end(),x)==v.end()) && (x>min1) && (x<max1)){
cout<<“YES”;
}
else{
cout<<“NO”;
}
}

Hi @ram_mahidhar we have a Youtube channel in which we are constantly posting videos related to Data Structures & Algorithms. Currently we are doing a Dynamic Programming series of 15 days in which we are taking every day a single question which teaches a new concept of DP.
Here is the link of series.
Youtube series