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

First off thanks for doing this, because I have questions. How do I get better at understanding the problems? I am doing beginner and just read the problem and want to claw my eyes out because I have no clue what they are asking. Is there a trick to getting better at it?

Are Duplicate Elements Allowed In a Binary Search tree???

When will November cook-off ratings be updated?

Can anyone tell me why my solution for problem LRQUER from november lunchtime is giving wrong answer on subtask #2 but correct answer on subtasks #1 and #3. CodeChef: Practical coding for everyone

How to calculate revenue in business ? Please explain it through example.

plzz upvote me i want to ask questions!!

if possible please clear my doubt : help in understanding strongly connected component in graphs - general - CodeChef Discuss

When I run this Prime generator it works fine , but when i give range for prime’s as 1 to 10000000 it stops working and everything crashes !

I recently learned Sieve of Eratosthenes and is implementation of it.

Please help. I find this Karma system bad for newbies like me and would appreciate any help. Thanks in advance.

:smiley:

#include <iostream>
#include<stdio.h>
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

int main()
{   ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    scanf("%d",&t);
   while(t--)
    {
        long long int m,n;
        scanf("%lld %lld",&m,&n);
        //Sieve
        bool prime[n+1];
        prime[0]=false;
        prime[1]=false;
        for(ll i=2;i<=n;i++)
            prime[i] = true;

        for(ll i=2; i*i<= n;i++)
        {
            if(prime[i])
            {
                for(ll j=i*2;j<=n;j+=i)
                    prime[j]=false;
            }

        }
        // Printing
        for(ll z=m;z<=n;z++)
        {
            if(prime[z])
                printf("%lld\n",z);
        }

    }

    return 0;
}

Why are solutions of ZCO practice contest of other coders are visible??

Is it because it’s a practice contest??

can someone explain with an example the use of upper_bound() and lower_bound() functions(as used in solving binary search problems)??

Hey, @vijju123,@admin

While using Codechef IDE, I noticed a bug. If a line is selected and Ctrl + / is pressed then, in general for other languages (I checked for C, C++ 6.3, C++ 17, PYTH, PYTH 3.5) the lines get commented out. But for PYPY, just a // is put before the lines, which is definitely not commenting out in case of PYPY.

Can you please check this and inform @admin if it is truly a bug (in case she does not notice).

Thanks.

What is error in my code?

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

Can Anyone Provide links and resources to study all about trees, related algorithms and it’s corollaries, from a beginner level?

please someone explain how to solve his?

help me… it working on all the tests i tried but i always get WA! where am i wrong?
https://www.codechef.com/viewsolution/16606169

how can I enter two,three values in a single line in python.
For eg. if I want to enter value of x,y in such a way
INPUT:
2 3
I want to input 2 3 in x and y ina single line .
How can I do this ?
will map function help me ?

Codechef Newbie here,

Below is my code for the recent Cookoff 89. Problem Football Match. It passes the example case, but then gives Wrong Answer after I submit. What is the error in my code?


n = int(input())
team1 = ""
team1count = 0
team2 = ""
team2count = 0
scoreArr = []
 
for x in range(n):
    testcaseNumber = int(input())
    for y in range(testcaseNumber):
        scoreArr.append(input())
    for z in scoreArr:
        if team1 != "" and team2 != "":
            continue
        elif team1 == "":
            team1 = z
            team1count = scoreArr.count(z)
        elif team2 == "":
            team2 = z
            team2count = scoreArr.count(z)
    if team1count == team2count:
        print("Draw")
    elif team1count > team2count:
        print(team1)
    else:
        print(team2)
    team1 = ""
    team2 = ""
    team1count = 0
    team2count = 0
    scoreArr = []
   

Thanks so much!

Where can I ask competitive programming questions?

Sometimes I am not able to understand problems or editorials or want to know some other way to solve the problem.Stack overflow community downvotes these type of questions.So is there any other site where I can post my queries and get answers in reasonable time?

@vijju123 I have read your solution for CHEFXOR of December long challenge I understand you have used SQRT Decomposition(if i am not wrong) can you please explain it a bit , or add some comments to the code so that I could understand it better ?
PS : big fan keep up the good work :smiley:

I solved a problem in BITFLIT v0.2 code SUPGLRES, and gave this solution, which is a generalised solution to any ordering of the queue (not necessarily the pairs need to be together, i.e, a random pair can be defined). But it ran into NZEC error. I would be thankful to anyone who can check the code and rectify the mistake:

import java.io.*;

class bitflit3test

{

public static void main(String[] args)throws IOException

{

BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

int i,j,n;

long k;

String l;

n = Integer.parseInt(br.readLine());

long [] a = new long[n];

l = br.readLine();

for(i=0;i<n;i++)  a[i] = Long.parseLong(l.split(" ")[i]);

for(i=0;i<n;i++)

{

  for(j=i;j<n;j++)

  {

    if(a[i] < a[j])

    {

      k=a[i];

      a[i]=a[j];

      a[j]=k;

    }

  }

}

for(i=0;i<n;i++)

{

  for(j=0;j<n-1;j+=2)

  {

    if(a[j]==a[j+1])

    {

      if(j==0) {  k=a[1];a[1]=a[2];a[2]=k;}

      else {k=a[j-1];

      a[j-1]=a[j];

      a[j]=k;}

    }

  }

}

k=0;

if(n%2!=0)  k=-1;

else

{

  for(i=0;i<n-1;i+=2)

  {

    if(a[i]<=a[i+1])

    {

      k=-1; break;

    }

  }

}

if(k==-1) System.out.println(“No”);

else  System.out.println("Yes");

}

}