Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all 40121 articles
Browse latest View live

Invitation to KJSCE CodeSpree 2017

$
0
0

KJSCE Codecell presents CodeSpree, with CodeChef as Programming Partner.

Contest will last for 3 hours. It will be an ACM-ICPC style contest. It will start on 1st October 2017 at 21:00 hours IST.

Anyone can participate in this contest. This is a part of Abhiyantriki, technical fest of KJSCE.

Prizes worth 2000/- and laddus are up for grabs.

Contest link is https://www.codechef.com/KJCS17

You can register here.

Join the Facebook page here.

P.S:-Only Indian participants are eligible for cash prizes or to get selected for the onsite round.

Update

The contest is over the winner will get a mail soon. If you haven't registered and were among the top participants please fill the google form above so that we can contact you. Thank you all for participating.


write a program to generate unique substrings(contains only unique characters) of given string.

$
0
0

please suggest efficient algorithm

Getting started here, questions about strategy, etiquitte, etc.

$
0
0

Hi guys.

I've just started here, I have a few questions about how I approach this place. Firstly, let me just say that wow - some of the problems here are pretty difficult, even for easy!

Alright, so I've just bunch of the questions in the FAQ, here's a few more.

  1. What's the etiquette for posting here? For example are 'I'm working XYZ practice problem, I've got TLE error, here's my code, what should I do?' questions ok?

  2. What's the general strategy for solving problem, or doing time optimization? Are there any tools that you use? Like, one of the things I can see that would be problematic, is when you get a 'wrong answer' but you don't know what the 'expected vs output' is. Is this just something you need to deal with as a programmer, to think of the corner cases yourself?

  3. Is there any way to get additional test data?

  4. How do you organise your code chef files in your IDE? For example, your class name (in Java) must called Main, and it can't be part of any package, when you paste in to the submitter, otherwise it'll give you an error, wondering how people deal with that.

  5. code reusablity - I get the feeling that a lot of this is going to be using various appropriate algorithms. What I would tend to do is import the package that contains the algorithm. But given that the submission has to be a single file with no non-native imports, is the only thing you can do, is copy the code in for each algorithm?

  6. Where would you start in terms of first problems to solve? For example I would suggest doing the Enormous Input test as one of your first problems.

.

data structure and algorithm

$
0
0

how queue is used in data structure

BINARY TREE

$
0
0

explain about binary tree concept

stack data structure

$
0
0

Difference between stack and queue

tree search

$
0
0

difference between linear search and binary search ?

binary search

$
0
0

why we are study binary search give some uses


binary search

$
0
0

Explain about binary search tree

difference between c++ and c++14 ??

$
0
0

what is the difference between c++ and c++14 ????

Invitation for ICO Preparatory Series

$
0
0

Hello everyone!

As you might know, the first stage of the Indian Computing Olympiad, the Zonal Computing Olympiad is approaching. Leading to the most prestigious programming competition for school students, IOI to be held in Tokyo, Japan next year. ZCO is to be held on 11th of November, 2017. For more information see the poster below or click here.




I'd like to invite everyone to a series of preparatory contests for the upcoming ZCO/ZIO and INOI. It will consist of short fun unrated contests which will be aimed for school students for preparation for the ZCO/ZIO and INOI. Nevertheless, it will also be beneficial for college students as ICPC is coming up. The contests are unrated.

Details about the series:

  • Contest will take place every friday starting from 13th of October.
  • Further details about each contest will be given as a blog post before each contest by the contest admin.
  • Each contest will consist of 4 problems.
  • Duration: 3 hours
  • Scoring system: IOI style
  • Difficulty will range from ZCO level to INOI level. That is equivalent to easy-medium in codechef terms. Problems might even have a hard subtask.
Problems would be set by:
1. Istasis ista2000 Mishra
2. Udit mathecodician Sanghi
3. Shashwat harrycoda Goel
4. Tanavya sinbycos Dimri
5. Rajarshi rajarshi_basu Basu
6. Vatsal vatsalsharma_3 Sharma
7. Swetanjal swetanjal Datta and
8. Yogesh yogesh01 Aggarwal


NOTE: In each contest only two of the setters will be involved and we wont discuss problems among ourselves so the other 6 of the setters may also participate.

You can ask for help regarding problems and discuss problems in this thread or in the contest announcement thread(which will be out later).

Also, please do tell us what do you think about this initiative in the comments. Any suggestions/feedback will be appreciated.

Hope you have a great time solving problems in the contests. :)

MULTQ3 - Editorial

$
0
0

PROBLEM LINKS

Practice
Contest

DIFFICULTY

MEDIUM

EXPLANATION

The problem can be solved using segment trees. Every node of the tree stores the following data :

1) tree0[k] : In the range [low..high] covered by this node, how many numbers are divisible by 3 considering just additions performed on numbers totally inside this range and not considering additions performed on ranges which are a subrange of the range covered at node k/2
2) tree1[k] : In the range [low..high] covered by this node, how many numbers leave a remainder of 1 when divided by 3 considering just additions performed on numbers totally inside this range and not considering additions performed on ranges which are a subrange of the range covered at node k/2
3) add[k] : What is the quantity which is added to all numbers totally inside this range and not considering additions performed on ranges which are a subrange of the range covered at node k/2

Is it necessary to add a reserve member to your team(ACM ICPC)?

$
0
0

Is it necessary to add a reserve member to your team or is that optional? Also how long does it take after you fill up the form about payment details on the Amritapuri Site to be reflected into the Baylor Site(Pending to Accepted)?

NO PARTICIPATION

$
0
0

My account always shows no participation. I did participated in LOCSEP17 and CNES2017 but it still shows no participation in any of the contest...Global and Country rank both are 0..HELP ME OUT..

How to Improve coding Proficiency?

$
0
0

Can Someone Guide how to improve coding proficiency and gain ability to solve hard or challenging problems in codechef.


string to number

$
0
0

You need to pass a secret key to your friend, which consists of all numbers but you don't trust the carrier. So, instead you pass a character string. You come up with a set of rules to map the string to the original key.

  1. Each character in the string should be replaced as the rule suggests.

  2. If the right hand side of the rule is a character, then this character should again be replaced till we find a number. The range of the numbers lies between 1 and 9.

  3. If no such number could be found but a cycle is detected, each such character should be replaced with 0. Note that this includes numbers which map to themselves (self loops).

  4. If no cycle is detected and no number replacement could be found, you should output -1.

  5. If a character appears in the test string which does not appear in the mapping, output -1. Input

First line of input contains a single integer T, the number of test cases. T test cases will follow. Each test case begins with a mapping. A mapping begins with a number N, the number of rules. Then N lines, each line in the form of A B will follow, where A is to be replaced by B. Then follows an integer K, the number of test strings. Then K lines follow, each line consisting of a test string. Output

For each test case, print on the first line # followed by the test case number, followed by the replacement string for every test string. Solution Templates

In the solution templates provided, complete the function whose signature is

C / C++ void decode (int n, char orig[26], char mapped[26], int k, char inputs[32][128], char outputs[32][128])

Java public static void decode(int n, char[] orig, char[] mapped, int k, String[] inputs, String[] outputs)

'n' is the number of mappings. 'orig' and 'mapped' store the original and mapped values respectively. 'k' is the number of queries. 'inputs' are the encoded strings. It is expected that you will store your answers in 'outputs', which is then printed by the template. Note that in JAVA, do not allocate outputs. It will be allocated, and hence put your answers in outputs.

Note: You are allowed to edit the code as you please. Add / delete headers. Add / delete methods. And so on.. So long as your final code solves the problem with Input and Output as described above. You may submit your own code, without using the template at all. Constraints

1<=T<=100 1<=N<=26 The left hand side of the rule consists of a single lowercase character The right hand side of the rule consists of a single lowercase character or a single non zero digit. No character will map to more than one character, i.e. you cannot have a situation where a maps to both b and c.

Sample Input

1 10 a b b c c a d e e f f 9 g h i j j 7 k p 3 abcdefij kabc aza

Sample Output

1

00099977 -1 -1

Explanation

String 1:a, b, and c form a cycle, and d maps to e, which maps to f, which maps to 9, and i maps to j, which maps to 7.

String 2: k maps to p, which maps to no nothing else. Hence -1.

String 3: The character z doesn't appear in the mapping. Hence -1.

FRUITS - Editorial

$
0
0

PROBLEM LINK:

Practice
Contest

Author:Sunny Aggarwal
Tester:Vasya Antoniuk
Editorialist:Pushkar Mishra

DIFFICULTY:

Cakewalk

PREREQUISITES:

Ad-hoc

PROBLEM:

Given are the number of apples ($N$) and oranges($M$) and $k$, i.e., the amount of money that chef has to buy apples/oranges. Each orange/apple costs 1 unit. What is the minimum difference that can be achieved.

EXPLANATION:

The problem is a very direct one. We have to minimize the difference. We can only increase the number of apples or oranges that we have. The logical step is to increase that commodity which is less because increasing the which is already more will only increase the the difference. Let $minC$ denote the quantity which is less. Let $maxC$ be the quantity which is more. The answer is given by:

$ans = maxC - min(minC+k, maxC)$

We have a min operation in the second term because the optimal case is to make both the quantities equal. If we have enough money to increase the lesser one to more than the other one, then we would rather make them equal so as to have a difference of zero, which is optimal.

COMPLEXITY:

$\mathcal{O}(1)$ per test case.

SAMPLE SOLUTIONS:

Author
Tester
Editorialist

THERE SHOULD BE AN OPTION TO REFER OR ASK QUESTION TO SOMEONE SPECIFIC

$
0
0

Since from my past days experience on discuss forum many time there comes some questions which are either out of their coding bounds of present time actives or they don't care to give time as they can answer multiple questions in the same time to cultivate karmas just as an example , I was asking a solution or hint of a problem (CDMN17C) I asked it twice and it been more than a week but till now nobody answered or not being able to answer. I also find many questions which were out of my present scope so I just pass over them but if there is any referring system at least I can refer problems to some better coders than me. Also take it as a request don't drop shitty comments about my first line Bro you are generalising your thought you shouldn't as I already mentined it as a thought . Problem link link text

What's wrong with this CODE (TTENIS)

$
0
0

Here is my code: Solution
The expected output is also produced and the limits of the variables is also satisfied. The output format is also correct. Is it that we don't have to print leading zeros? Please help me with the code.
Thanks a lot!

First Google Your Doubt Then Codechef Discuss

$
0
0

I have seen many person who are just posting questions which have a direct link on one google search.

1) If there is a direct link for that question then asking that question is not very helpful.

2) If there has already been a discussion for that topic in codechef discuss then don't make a new question for that ,instead comment in the previous post only.

3) Also don't ask any question related to an ongoing contest.

Viewing all 40121 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>