You are not logged in. Please login at www.codechef.com to post your questions!

×

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

15
2

Hello guys,

UPDATE- This thread is now for people who are unable to ask questions due to low-karma/losing-karma or time limit.

As you all are aware, many times there are genuine users who wish to ask a question, but dont have karma for it. They then, have to resort to means of either asking their question in other threads, or request someone to upvote them so they can ask a question.

As we have seen last month, some fake accounts were used in malpractices in discuss, and they also gained karma by "I want to ask a question" thing. Hence, now it is becoming increasingly difficult to differentiate between genuine users, and fake users.

This thread is my solution for it. Any user, with less than 3 karma who wants to ask a question is requested to ask it here, and if the question is upto standards (meaning it needs more than those "one line answers") then we (at least I ) will convert your "answer" here into a question.

In short, post your question here, and if its a good genuine question, it will get posted as a separate question by using "Convert to question" feature.

In case your question required only 1 line answers or such, we would comment it on your question.

You guys are requested to direct any such guy (who wants to ask a question) here and not "free-upvote" them, so that we can avoid any duplicate/irrelevant questions (as questions posted here would be verified first, before converting to question).

Note to @admin - We will require your active participation and help in events related to deletion of any spam content here. Also, since only admins are ones who could delete answers, it is requested that you keep an eye out on this thread.

With Regards

Vijju123

This question is marked "community wiki".

asked 09 May, 10:26

vijju123's gravatar image

4★vijju123
6.5k211
accept rate: 17%

edited 14 Jul, 12:58

Users are requested to give their views as COMMENTS to this question.

Only questions should be posted in this thread (to keep it clean)

(09 May, 10:29) vijju1234★
2

Pretty cool idea

(09 May, 11:41) neilit19923★
2

I think it will be better as a community wiki.

(09 May, 14:22) mathecodician5★

If you feel so. :) . BTW, now i can also see the revision history :p

(09 May, 14:47) vijju1234★
1

Great initiative @vijju123 !

(19 May, 22:15) akashbhalotia3★

PLEASE NOTE-

ANY QUESTION RELATED TO ON-GOING CONTEST WILL BE STRICTLY DELETED.

(21 May, 22:43) vijju1234★

Please note- Inactive questions etc. will be removed after 24 hours of inactivity. Users are requested to tell if their query is answered or if there is still need to convert comment to Q .It will help us in managing this thread.

(22 May, 20:29) vijju1234★
1

@vijju123 is the man ! :D

(09 Jun, 22:48) godslayer122★
showing 5 of 8 show all

include<iostream>

using namespace std; //Pre And Post Increment Behaivour int main(){ int a=2,b; b=a++ + a++; cout<<"The value is "<<b<<endl; //Output=5

a=2;
b=a++ + ++a;
cout<<"The value is "<<b<<endl;
//Output=6

a=2; 
b=++a + a++;
cout<<"The value is "<<b<<endl;
//Output=7 HOW? 
a=2; 
b=++a + ++a;
cout<<"The value is "<<b<<endl;
//Output=8 HOW??


return 0;
}

I couldn't understand the last Two outputs.. Can anyone help?

link
This answer is marked "community wiki".

answered 21 May, 13:57

xtraterestrial's gravatar image

0★xtraterestrial
1
accept rate: 0%

1

If you change the value of a variable more than once in c, like (++a + a++ + --a etc.) then its undefined behaviour. Its all on luck what gets printed. You got an output of 6, which is a nice co-incidence.

In short, unlike java, these operations lead to undefined behaviour in C (and perhaps c++?)

Comment if it answers your question.

(21 May, 14:04) vijju1234★

Answer to the above asked question.. output is 6 as ,first increment the whole thing in one go,now put the incremented value at pre-increment and start calculating from the left by putting the actual value in post-increment. As,b=a++ + ++a ;// b = 2 + 4; b=++a + a++;// b=4 + 3; b=++a + ++a;//b = 4+4;

(15 Jun, 14:41) amitkm92042★

I am a learner in programming .Where can I search for algorithm .I mean ,tell me a good source website to learn algorithms.

link

answered 21 May, 19:26

ram_mahidhar's gravatar image

4★ram_mahidhar
112
accept rate: 0%

geeksforgeeks.org is best website for this. Also, there are tutorials on codechef, and many answers which deal with how to start coding/learn algorithms. Give forum a search (cant provide link atm, any other user who can is requested to provide link)

(21 May, 20:17) vijju1234★

I can't reply to ram_mahidhar directly, but here's a good book for beginners:

https://cses.fi/book.html

(21 May, 21:47) vasja5★
(26 May, 10:27) gary_5710★

How many karma points will a person get if his answer is upvoted? And how many karma points he will lose by asking a question and how many karma points will he lose if his answer gets downvoted?

UPD: Also what are badges? Will someone get karmas for earning badges?

link

answered 11 Jun, 15:03

xerefic's gravatar image

2★xerefic
612
accept rate: 0%

edited 15 Jun, 15:34

1

answer is 10,0,2

(11 Jun, 15:07) hruday9684★

Google "Codechef's new karma system" and you will find every detail needed on codechef blog.

(11 Jun, 15:24) vijju1234★

Badges can be taken as "trophies" you get for some achievement. No, they dont affect karma in any way.

(15 Jun, 17:21) vijju1234★

To stabcode, for his Q on two num-

Your code is looping through i=1 to i=number of turns. That is causing TLE since N can be very large. You need to derive a formula of ans in form on A,N,B. You will find that no matter how large the N is, if N is even, its effect is nullified upon divison and this reduces the answer to max(A,B)/min(A,B). If N is odd, alice gets 1 turn more so we replace A by 2 x A and do the same.

Wrote answer thrice but due to some bug at forum its giving error, hence answer posted here. Comment if things arent clear.

link

answered 17 Jul, 15:54

vijju123's gravatar image

4★vijju123
6.5k211
accept rate: 17%

What is the best way to check my code execution time?

link

answered 22 May, 23:42

irikeish's gravatar image

1★irikeish
1
accept rate: 0%

@irikeish

Run it on "Code, Compile and Run" and it will show you the exact time.

If you mean execution time for larger test cases, meaning "if this algo will pass or not", just remember that online judge performs 10^8-10^9 instructions per second. So if your program is like-

for(i=0;i< n;i++) { for(j=0;j< n;j++) { .... } }

Then for every i, second loop repeats N times. Overall, things are performed N+N+N...(upto N times) = N x N = N^2 times

So if N is around 10^5, it requires 10^10 instructions which exceeds time limit.

You will get a fair idea like this and when you practice and look for new algos.

Do indicate via comment (on your answer)if this resolves your query or not. (Couldnt post as comment as it exceeded limit :/ )

(23 May, 00:00) vijju1234★
1

@irikeish you can use the clock() function defined in the time.h header file. your code could be like this.

#include <bits/stdc++.h>
using namespace std;
int main()
{
    clock_t start = clock();
    //your code part of which you want to check the execution time for.
    clock_t end = clock();
    double t=(double)(end-start)/CLOCKS_PER_SEC;
    //now the varialbe t contains the execution time in secs. Just print it to check the time.
    printf("%lf\n",t);
    return 0;
}
(23 May, 00:16) floating_point3★

can anyone tell me why im getting TLE in SNAKEEAT problem in snackdown_17 qualifier ! here is the link to my code https://www.codechef.com/viewsolution/13663672 ...and also suggest d best approach !

link

answered 24 May, 18:07

msd_007's gravatar image

3★msd_007
2897
accept rate: 7%

edited 24 May, 18:11

vijju123's gravatar image

4★vijju123
6.5k211

for(int y=m-1;y>=0;y--) { a[y]=a[y]+1; if(a[y]>=b[r]) { c++; a[y-1]=a[y-2]; a[y-2]=0; } }

This loop inside the query loop makes your complexity O(NQ) in worst case and it would require ~10 seconds to solve. Read the editorial first, if doubt still persists, comment here and i will convert it into a question.

(24 May, 18:13) vijju1234★

There is another thread asking the same question, keep an eye there too. The methods followed are basically same.

(24 May, 18:17) vijju1234★

Why can't I submit my code for May Long Challenge? Up-solving the problems that you were not able to solve in a contest is a must. But the submission link is removed. Also, I want to ask about the editorials of the long contests. The May Long questions are still not provided with editorials. The last one : Is there a way by which I can view the test cases after the contest ends?

link

answered 25 May, 18:42

rohitthapliyal's gravatar image

3★rohitthapliyal
1
accept rate: 0%

The problems are moved to practice section. To easily get to the practice version of problem-

1)Click on weblink 2)remove the part "/MAY17" 3) HIT enter.

Regarding editorials, forum users cannot comment anything. Try mailing codechef about it, or try to ask the question as doubt here, we will surely help!

No, there is no way of viewing the test cases.

(25 May, 18:52) vijju1234★

That helped. So, there won't be any editorials?

(25 May, 22:14) rohitthapliyal3★

Depends...only @admin can provide any information on it, and its advised to mail them for this. However, i case you need an editorial urgently, one of the discuss members would love to write one. Just ask once :)

(25 May, 22:29) vijju1234★

ok thanks.

(26 May, 15:11) rohitthapliyal3★

Can anyone tell me why this code is not functioning properly?Can we accept and display a string like this?

    main()
  {
   string a;char ch;

   for(int i=0;i<5;i++)
{
     cin>>ch;
      a[i]=ch;
}

     cout<<a;
    }
link

answered 26 May, 10:38

senacoder111's gravatar image

2★senacoder111
1
accept rate: 0%

edited 26 May, 12:15

vijju123's gravatar image

4★vijju123
6.5k211

Please give the link to question also. I will then convert it to a question.

(26 May, 12:15) vijju1234★

if a is a string, dont use a[i] = ch. Use a= a+ch; This will have the desired effect.

(26 May, 12:16) vijju1234★

Sir,thank you for replying,but why should we not use it like that?

(26 May, 13:55) senacoder1112★

Well. I feel it can cause run time error due to "out of index" thing. We used this method in C, but there C was an array of char (length pre defined).

Here, we dont know length if string but we are making changes at i th index. Remember that string also gives out of index error just like array (eg - if arr[n+5] gives runtime error, then so will s[n+5]. Faced these issues during contests.

Treating it similar to array, i think you will get an error. But s=s+ch is different. It says "whatever be s, add ch to its end" , so theres no scope of going out of index here.

(26 May, 14:22) vijju1234★
1

thank you very much sir,i will change it.

(26 May, 17:39) senacoder1112★

Is using insertion sort in SNAKEEAT problem causing TLE?

https://www.codechef.com/status/SNAKEEAT,amanawasthi96

link

answered 26 May, 13:22

amanawasthi96's gravatar image

2★amanawasthi96
151
accept rate: 0%

Insertion sort is O(N^2) in worst case and can cause TLE depending on input.

(26 May, 14:17) vijju1234★

Hi everyone, can anyone tell me why am I getting WA with this code the problem CHEFSQ ? I've tried different test cases and they all seem to give me the correct answer...

Thanks !

link

answered 26 May, 15:59

sysm's gravatar image

2★sysm
111
accept rate: 0%

Answer to sysm: The sub sequence doesn't have to be continuous, but the order of elements should be maintained. Input

1
5
1 2 3 4 5
3
1 3 5

Your Output:

No

Correct Output:

Yes

my C code

(26 May, 16:28) divyansh_gaba74★

Haaaaaa. Thanks for your answer !

(26 May, 16:31) sysm2★

Sir,my code for permut2

https://www.codechef.com/problems/PERMUT2 is not working properly,I am unable to debug it and desired output is not coming for a few problems. PlEASE HELP

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

link

answered 26 May, 21:26

senacoder111's gravatar image

2★senacoder111
1
accept rate: 0%

Your question has been shifted here-

https://discuss.codechef.com/questions/99127/kindly-help-me-for-spoj-ambiguous-permutation

It has been upgraded into an individual question. Make sure to keep an eye there to clarify your doubts!

(26 May, 21:32) vijju1234★

Thank you sir.

(27 May, 11:44) senacoder1112★

I got wrong answer in the samesnak problem asked in snack down qualifiers. Can anyone please tell me what's wrong with the code. Here's the link: https://www.codechef.com/viewsolution/13762975

link

answered 26 May, 23:10

avi0_8's gravatar image

0★avi0_8
1
accept rate: 0%

Can you please check once the test cases provided by fellow members to other people who got WA? Have a look at similar questions and the errors, and then comment here if help is still needed. I will then convert it to a question (This question is being repeatedly asked, hence my request to have a check :) )

(26 May, 23:50) vijju1234★

Can anybody tell me what is meant by number of stars beside a users' name? I have seen many people having different number of stars beside their name. Some have 3 or 7 or so.

link

answered 27 May, 21:42

bhagatdivesh21's gravatar image

0★bhagatdivesh21
1
accept rate: 0%

Stars are awarded on basis of your ratings. More ratings=more stars= meaning the user did well in contests

(27 May, 21:45) vijju1234★

IS THERE ANY WAY OF EARNING KARMA POINTS OTHER THAN UPVOTING WHICH IS EASY PLZ REPLY

link

answered 27 May, 22:36

soheb17's gravatar image

3★soheb17
1
accept rate: 0%

According to the Buddhist belief Karma is that whatever you do comes back to you, e.g. if you do something good, something good will happen to you, and vice versa.

For more info. https://blog.codechef.com/2014/11/18/the-new-karma-system/

(28 May, 18:10) divyansh_gaba74★

Can I get May Lunch Time Questions in Practice block ?

link

answered 28 May, 12:08

bhola_nit's gravatar image

3★bhola_nit
111
accept rate: 0%

A thread would be created if this doesnt happen by 11pm today. Dont worry :)

(28 May, 12:09) vijju1234★

The thread has been created. Please keep an eye out there for updates :)

(29 May, 02:07) vijju1234★

Doesn't lunchtime have editorials?

link

answered 28 May, 17:08

saahilk's gravatar image

5★saahilk
1
accept rate: 0%

They usually have.

(29 May, 02:07) vijju1234★

getting "successfully executed" on online IDE...bt when i submit it im getting runtime error !! is der any way to check my error ??

link

answered 01 Jun, 01:46

msd_007's gravatar image

3★msd_007
2897
accept rate: 7%

This usually happens when accessing out of index in an array/string. Please give link to question and solution for us, so that we can help you further. :)

(02 Jun, 00:00) vijju1234★

In the latest SNCKPB17 contest, in SNELECT, can you provide all the trick cases because according to me there is no error in my code even after spending 2 hours on it. It will really help a lot. Thank You!

link

answered 01 Jun, 03:10

autocrat137's gravatar image

3★autocrat137
1
accept rate: 0%

This is against the rules.

(01 Jun, 11:05) vijju1234★
  1. What is the "accept rate" below each user's name in the forum?
  2. After each contest, how long until rating and solving activity are updated?

I did SnackDown Pre-A which was several days ago, but neither rating nor "solved problems" on my profile have been updated since then. Or are these 24-hour contests unrated? Thanks Vijju.

link

answered 01 Jun, 15:23

royappa's gravatar image

2★royappa
211
accept rate: 0%

Accept rate is the % of answers (of that user) which got accepted by other users. Accepted answer means the answer satisfied the query of the one of who asked the query and rewards the answering user with karma.

Ratings can take time sometimes, while at times they are done instantaneously . Snackdown is elimination rounds are not rated afaik. Lunchtime, Coofoff and Long contests are rated, and any external contest which they declared as rated. All other contests are unrated.

(01 Jun, 16:11) vijju1234★

Got it, thanks!

(02 Jun, 00:46) royappa2★

i am trying to solve beautiful arrays question. in IDE the input i gave (in accord to format) gives right output , but my answer is shown wrong. can i see (at least some of them) test cases (my code gives right output for test cases provided on site)? Here's the link: https://www.codechef.com/viewsolution/13978678

link

answered 02 Jun, 12:26

leo_alex123's gravatar image

2★leo_alex123
1
accept rate: 0%

1

your code fails for this testcase

1

5

-1 1 1 -1 1

your ouput:no

Expected output:yes

(02 Jun, 12:33) hruday9684★

Will the problems solved in the recent snackdown pre-A, pre-B rounds be added to my "recent activity"? It shows practice problems solved, so even though those contests are unrated I was hoping to see them there (just to keep track). Thanks!

link

answered 02 Jun, 13:12

royappa's gravatar image

2★royappa
211
accept rate: 0%

If solved in practice, they should be added. If during contest, then i am not sure (although answer inclines to a no). Anyways, its more of a question you should ask via mail to admins.

(02 Jun, 16:22) vijju1234★

As the problems were submitted on the behalf of your team, and not as you. It won't be added to your "recent activity".

(02 Jun, 22:25) divyansh_gaba74★

Can I ask questions regarding modifications required in the code?

link

answered 02 Jun, 13:23

saurabh0612's gravatar image

3★saurabh0612
111
accept rate: 0%

This question needs more details to be complete.

modification of which code? The code given in editorial, or "modifying and debugging my code to help me fetch AC" ?? OR any other interpretation?

(02 Jun, 16:20) vijju1234★

SNAKGRAPH SNPB17 https://www.codechef.com/problems/SNGRAPH Can any one tell for which test case my code fails?https://www.codechef.com/viewsolution/13974266 please tell also about self loop (GIVEN IN CONSTRAINT).

link

answered 02 Jun, 21:31

abhishekp233's gravatar image

0★abhishekp233
1
accept rate: 0%

Self loop means a node having edge to itself i.e edge from 'u' to 'u'.

Multi edges meaning There exists more than two edges from Node 'u' to node 'v'. Input:

1

5 5

1 2

2 3

2 4

4 5

1 5

Correct Output:

0 1 4 4 4

Your Output:

-1 0 4 4 4

(02 Jun, 22:19) divyansh_gaba74★

Thanks divyansh for helping him out :)

(02 Jun, 23:15) vijju1234★
1

Always happy to help :)

(02 Jun, 23:44) divyansh_gaba74★

How to optimize this kind of loop for(i=0;i<la;i++) for(j=0;j<lb;j++) for(k=0;k<lc;k++){\code}

link

answered 02 Jun, 21:55

chang012's gravatar image

1★chang012
-1
accept rate: 0%

edited 02 Jun, 21:58

It depends on what you are trying to do, so missing details doesn't help.

Also this seems to be a problem from the June17 Long challenge, so it's good that you missed the details and keep it that way :)

(02 Jun, 22:22) divyansh_gaba74★

can anyone explain dis problem statement with example cases clearly...https://www.codechef.com/JUNE17/problems/NEO01/

link

answered 04 Jun, 21:56

msd_007's gravatar image

3★msd_007
2897
accept rate: 7%

Ask this at comment section of problem. If its not violating rules, problem setter oughts to reply. Admin says that problem shouldnt be discussed on discuss while contest is live...

(04 Jun, 22:38) vijju1234★

can i submit my logic to june contest and ask where it wrong?

link

answered 05 Jun, 21:17

ani_1107's gravatar image

1★ani_1107
1
accept rate: 0%

@ani_1107

No it is not allowed as it is an ongoing contest.

(05 Jun, 21:19) hruday9684★

Discussing of problems of a live contests are against the rules. So, Nope :(

(05 Jun, 21:19) divyansh_gaba74★

Hi! I tried to submit a code but codechef isnt accepting it. It doesnt move forward to the window where it shows 'running', it always hangs on a specific code. When i tried to submit another code which is not related to the question, it accepted and showed a WA. But when i submit this specific code, it doesnt accept. What do i do? I think its a bug or something

link

answered 06 Jun, 16:15

cersei's gravatar image

3★cersei
1
accept rate: 0%

Please provide the exact link to the question.

(06 Jun, 16:21) shraeyas3★

Why do I am not able to view others solution of the contest Snackdown elimination round? Also the editorial is taking a whole lot of time to upload.

link

answered 06 Jun, 20:00

coolrohan123's gravatar image

3★coolrohan123
562
accept rate: 10%

Its best if you move this to the question related to snackdown editorial.

(06 Jun, 20:09) vijju1234★
1

Probably because when they made the mirror, everyone was able to see the solutions and some people used it for cheating, so they denied access and forgot to revoke that. And true :( editorials are taking long. There is a post regarding that issue already here: https://discuss.codechef.com/questions/100670/pleases-upload-snackdown-elimination-round-editorials

(06 Jun, 20:09) divyansh_gaba74★

If you have a specific problem you want solution of, you can request the fellow members of discuss to help you.

(08 Jun, 19:57) vijju1234★

Why do I get SIGSEGV runtime error for this code?here is my code https://www.codechef.com/viewsolution/14165238 check it once

link

answered 09 Jun, 00:58

dimpu123's gravatar image

0★dimpu123
1
accept rate: 0%

Firstly, dont spam discuss by asking same thing multiple times. Then, N varies from 1-10^9. For 10^9, you will exhaust the maximum recursion depth and hence get a SIGSEV. Your function has a limit upto which it can undergo recursion.

(09 Jun, 01:20) vijju1234★

sorry for asking multiple times.what changes i have to do in my code?can u please tell me?

(09 Jun, 13:10) dimpu1230★

The changes are simple. First thing is, that the function repeats after every 6th number. Meaning-

F(1)=F(7), F(2)=F(8) and so on...

All you have to do is to compute the first 6 values of function (do some maths on paper!). Then, do N%6 and arr[N%6-1] is the answer. (To understand this, i repeat, DO it on paper, find out values of F(1), F(2)...F(8) in terms of A and B, and then it will make perfect sense!)

(09 Jun, 13:31) vijju1234★

Thanks @vijju.:)

(09 Jun, 13:44) dimpu1230★

In case you get stuck on implementation, you can view my code here-

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

(09 Jun, 13:53) vijju1234★

Hi Team,

I tried to submit a solution to one of the problems on this site. However it shows as NZEC error. I have tested my code successfully with few test cases in my local IDE as well as on ideone.com

Since, it is failing at codechef, I understand my code is failing with few test cases. Now, how to understand -

1) What is the actual runtime error the code is throwing?

2) For which test case (set of inputs) my code is failing?

Regards,

Lalitha

link

answered 09 Jun, 14:00

jee_lalitha's gravatar image

0★jee_lalitha
11
accept rate: 0%

edited 09 Jun, 14:01

Please give a link to the question, as well as your solution. Because without seeing your code, its not possible to pin-point the exact reason behind the error.

(09 Jun, 14:43) vijju1234★

Hi,

Thanks for the reply. I would want to rectify the error myself at least till I give up.. :)

I am more keen in understanding, where in this website can I find the output the code is generating? I am just seeing a NZEC in the MySubmissions page; but not clear of what exception the code is throwing.

Regards, Lalitha

(09 Jun, 14:55) jee_lalitha0★

NZEC error most commonly happens when you access an array out of bounds, especially in JAVA. I will suggest you go through any nested loop and make sure its of type-

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

(09 Jun, 17:41) vijju1234★

What kind of error does data overflow gives? Context: I changed data-type from int to long and I am still getting WA

link

answered 09 Jun, 18:21

karanmundra's gravatar image

2★karanmundra
0
accept rate: 0%

edited 09 Jun, 18:46

vijju123's gravatar image

4★vijju123
6.5k211

Which language are you using? If its C++, then long and int have same memory. Use long long int instead of long or int.

Data overflow usually gives WA.

(09 Jun, 18:45) vijju1234★

I am using Java

(09 Jun, 18:54) karanmundra2★

Then it must be a logical error on your part. Make sure to read the Q carefully and check comments (if any).

(09 Jun, 18:58) vijju1234★
1

Thanks vijju, it was a logical error. Got AC.

(09 Jun, 19:33) karanmundra2★

I am a member from one of the SnackDown Online Elimination top 300 teams (fzszacm)

I haven't written the address in my own account.

Could I edit my address these days?

And the address need to be in English(or counld I use Chinese?) Sorry for my poor English :)

link

answered 09 Jun, 19:24

l0nl1f3's gravatar image

0★l0nl1f3
1
accept rate: 0%

Actually it's completed now.is it right now ?

(09 Jun, 19:40) l0nl1f30★

Goto your profile and use the pencil button to edit things out. Its better if you use english. Regarding use of native language in address, please mail them at help@codechef.com because its they who can best tell regarding this.

(09 Jun, 19:41) vijju1234★

Hey everyone.. There are a few problems which executes faster in first lang than in second. Also the solution in second lang might exceed the time limit. Can anyone please suggest me how to prefer a language to avoid exceeding time limit? Also what to do in such situations?

link

answered 11 Jun, 16:51

richavin97's gravatar image

1★richavin97
1
accept rate: 0%

Slower languages are given appropriate time compensation so that they dont get TLE if algo is fine. You should, however, prefer c++ ideally.

(11 Jun, 18:02) vijju1234★

Why can't I see the comments in the JUNE challenge problems. I have faced this issue before too. When I want ot see the comments it shows no comments. Are the comments not available for everyone?

link

answered 12 Jun, 12:39

nvs232's gravatar image

4★nvs232
212
accept rate: 0%

Comments are usually hidden until admins decide otherwise.

(12 Jun, 17:01) vijju1234★

please see why my code (https://www.codechef.com/viewsolution/14246552) for SNELECT gives this and i got this error many times but couldn't get why? please answer..... this error..... Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextInt(Scanner.java:2117) at java.util.Scanner.nextInt(Scanner.java:2076) at Codechef.main(Main.java:14)

link

answered 13 Jun, 18:03

manoj09's gravatar image

2★manoj09
1
accept rate: 0%

why do i need to check through in.nextInt() or some other?? and even after checking now it gives runtime error(nzec) why? someone pls help?

(13 Jun, 18:18) manoj092★

@manoj09 your link is broken.

(13 Jun, 18:22) sysm2★

@manoj09 try this testcase

1

m

(13 Jun, 18:28) olofmeister4★

hey @olofmeister , can you help him get some details on that error. I think its due to negligence of white spaces or something like that. Your opinion? :)

(13 Jun, 18:54) vijju1234★
1

@vijju123 @manoj09 , i guess accessing direct elements such as ch[1], without knowing they have been initiated before may lead to a runtime error(i am not 100% sure, as this is a condition of SIGSEG too), but as u can see, u have directly used ch[1] and ch[ch.length-2] which wont be declared for string size of 1, and as expected it gives a runtime error on strings of length 1. I think that could be the case.

(13 Jun, 20:20) olofmeister4★
1

thanks everybody ...i got it

(13 Jun, 20:52) manoj092★
showing 5 of 7 show all

Hello, i'm a newcomer to CodeChef. During contest I couldn't find any information about memory/time limit for the task. So if it exists, please show where to look up for it.

link

answered 13 Jun, 19:00

bobra's gravatar image

3★bobra
312
accept rate: 0%

time limit and memory limit for a particular question in codechef(any problem may b practice or contest) can be found if u scroll down till bottom..... @bobra der u can see details about author,tester,time limit,source code limit !! happy coding:)

(13 Jun, 19:06) msd_0073★

Just a small correction, memory limit is not the source limit. Usually memory limit is ~256 (or 512) MB. You can declare an array size upto 10^8 easily (~10^4 for 2-D array). (Array sizes of 10^9 give error as they take too much memory)

(13 Jun, 19:32) vijju1234★

ohh im sorry nd tqq @vijju123

(13 Jun, 19:33) msd_0073★

Thanks for helping him dear ^^

(13 Jun, 19:34) vijju1234★

Thank you. This will help a lot:D

(13 Jun, 21:49) bobra3★

why i m getting this error.... Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextInt(Scanner.java:2117) at java.util.Scanner.nextInt(Scanner.java:2076) at CodeChef.main(Main.java:10) ...... in my code https://www.codechef.com/viewsolution/14253104

link

answered 14 Jun, 17:31

manoj09's gravatar image

2★manoj09
1
accept rate: 0%

question from chef and feast(NEO01)

(14 Jun, 17:32) manoj092★

Where are you getting this bug? If this would had been the case, you wouldnt get WA after 0.81s, but instantly at 0.00sec. Are you inserting input in correct format? In JAVA, inout is sensitivive to extra spaces and extra lines.

(16 Jun, 10:46) vijju1234★

Guyz I am pretty much new to coding..I mostly am only able to apply brute force on questions! Can anyone suggest me a good book for Data Structures and Algorithms pls? P.S: I need a book not a soft copy or websites. Thanks for the help :)

link

answered 14 Jun, 19:54

dishant_18's gravatar image

3★dishant_18
2437
accept rate: 9%

I will say rather start from geeksforgeeks.org , most of the books will deal only with basics and you will need more than it. Also, give a search on forums, this question regarding books and notes are answered alot before.

(14 Jun, 19:59) vijju1234★

Thanks man :)

(16 Jun, 11:05) dishant_183★

When will the editorials of JUNE17 arrive. Why does codechef no longer upload the editorials of contests on time ? Its been 3 days the long challenge has ended and no editorial has arrived yet!! December long challenge had no editorials and I still struggle with this and this problems from that contest. Then February challenge again had no editorials and the last 2 questions were really nice and are still left for me to upsolve. Then May had no editorials of last 4 questions and now June has no editorials yet. Why not create editorials before the contest ? When will the editorials of these contests arrive ?

link

answered 15 Jun, 22:05

vivace's gravatar image

4★vivace
461
accept rate: 10%

You could have created a Q yourself...You want me to convert it into a question??

TBH, seeing the pattern, i dont think the editorials will come out...But i see that community has been really helpful this time. Alot of questions are discussed actively and excellent approaches were given. You can refer those till then. :)

(15 Jun, 22:21) vijju1234★

can anyone please tell me as to how could I do IPC train of July'17 Long using lazy propagation.? Is this even possible?

link

answered 17 Jul, 15:07

kunal12's gravatar image

3★kunal12
345
accept rate: 0%

Check the editorial once, if things are not clear i will explain. No, lazy propagation was not needed there.

(17 Jul, 15:51) vijju1234★

Can you please explain the logic of calculator for passing the 2nd test case as it is bothering me?

link

answered 17 Jul, 15:15

coderholyy's gravatar image

2★coderholyy
11
accept rate: 0%

Is the editorial unclear to you? If yes then i will elaborate, else its fine ^^

(17 Jul, 15:28) vijju1234★

sorry.. editorial wasn't uploaded when i asked the question and thanks for the reply, i then checked it and understood the editorial.

(17 Jul, 15:48) coderholyy2★
toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×155
×82

question asked: 09 May, 10:26

question was seen: 4,438 times

last updated: 17 Jul, 15:54