Those all people who ask for help, and then directly submit their codes, please refrain from submitting your codes without atleast posting your logic. People do not really want to get into reading code if there are neither comments in the code, nor any logic has been mentioned, like what are you trying to do and stuff. Also, I have seen people not testing their codes on sample testcases but directly asking why it is wrong. Please don’t do such things, and everyone would be happy to help you!
I’ve been toying with the idea of posting a thread like this (people keep making the same annoying mistakes with asking question over and over again - not formatting their code; not mentioning what Problem they are solving, let alone providing a link; etc), but then it occurred to me that the people who most need this guide are precisely the people who are least likely to look for and read such a guide XD
True that, but it would be helpful to mention this as a reply for who-so-ever asks for help improperly XD
@ssjgz @sahil0907 People are not going to change they are always going to post the code rather than explaining with comments, so I think code-chef should update the whole system of Code-Chef Discuss and introduce a new set of rules and create moderators, just like Stack Exchange to make the community better, knowledgeable so that it can grow.
Thanks for reading
Peace
Hmmm … good point Here’s an initial draft of such a thing that I’ve just knocked up based on things that have annoyed me recently - might see if I can tidy it up and make it into something useful:
ssjgz’s Ideal Question Guide
- Keep the title short, and don’t got to great lengths explaining what you’ve done so far - that can be left in the body of the question.
- Always mention (at least) the Problem code. The Problem name in long-form can be added if it doesn’t make the title too long
- Please explain (very briefly) why you need help - WA? TLE?
- Please don’t use the “editorial” tag when asking a question!
- Always ensure that you have passed all the sample testcases; if you have not, mention this clearly in the body of the question.
- Include a (clickable!) link to the Problem - people don’t want to have to Google it to find it!
-
Format your code or (better!) include a link to your submission.
- The forum software messes up source code that is directly pasted; see “Why format my code?” for more details.
- A guide to formatting code can be found here, courtesy of @syntaxhacker.
- You can find the list of your submissions by clicking on “My Submissions” for the Problem; clicking on the “View” button for the submission you want to ask for help about; and copying and pasting the URL from your browser.
- If the code you want help on isn’t a CP Problem but is just a task you’ve set yourself for practice, please include the test input that is causing the failure; the expected output, and why you expect this output; and the actual output.
Example (Good!):
Title: Why am I getting WA (BACREP)?
Body:
Link to Problem.
I’m getting a WA in the “Bacterial Reproduction” practice Problem. The link to the WA submission is here.
All sample testcases pass. Can someone find me a testcase that my submission fails on, or can someone point out the bug?
Example (Bad!):
Title: Please help me urgently >>> all testcases pass but actually they don’t because not accepted
Body:
here’s my code
<Glob of ASCII noise omitted for the sake of sanity >
This is bad because:
- Solving any Codechef Problem is probably not urgent
- Meandering title that somehow manages to omit all important information.
- You’re obviously not passing all testcases, as your submission isn’t getting accepted.
- I have no idea from the title what Problem this is, and I’m reluctant to waste my time and energy clicking to find out
- You don’t tell me why it’s not getting accepted - WA and RE have very different causes to TLE.
- Body does not contain even the name of the Problem, let alone a link I can click on!
- If you’re going to ask multiple people for help, the least you can do is given them formatted, indented, and above all compilable code
- Unformatted code, on top of containing mistakes, is deeply unpleasant to read
- This also cuts down on the noise from people replying with “Oh, obviously the problem is this: <compiler error that is clearly not in the original code and is the result of just copy-n-pasting source code into Discourse>”.
Why format my code?
#include <iostream>
using namespace std;
int main()
{
int T;
cin >> T;
while (T--)
{
string s;
cin >> s;
int numAs = 0;
for (const auto letter : s)
{
if (letter == 'a')
{
numAs++;
}
}
cout << numAs << endl;
}
}
when pasted in the forums becomes this:
#include
using namespace std;
int main()
{
int T;
cin >> T;
while (T–)
{
string s;
cin >> s;
int numAs = 0;
for (const auto letter : s)
{
if (letter == ‘a’)
{
numAs++;
}
}
cout << numAs << endl;
}
}
Apart from looking like someone has thrown a bucket of ASCII into my face, the code now contains numerous errors that weren’t present in the original code:
- The
<iostream>
is absent from the first line - The
T--
has becomeT‒
, which is invalidC++
- The
'a'
has become‘a’
, which is invalidC++
.
Java gets similarly mutilated, and Python - in which leading whitespace is very important - has all its leading whitespace stripped out(!)
pls help me debug my 300 - line code it passes all given test cases but not getting accepted also im getting something called a runtime error somebody explain to me what it is pls pls pls im too lazy to bother searching on my own and requires spoonfeeding
Yep Yep!! Just copy paste your code here alreadyyyy…
What are you waiting forrrr???
Forum program considers it as spam so y’all gotta search my submissions and find the one with 300 lines. I’m not even gonna bother giving a link because that’s how lazy I am.
Its either that my query is highly professional,which I really doubt, or people are still not happy enough to help me.
Have edited my post accordingly.
can someone help me out now?
Where is it?
updated my last reply!
I was taught by codeforces discord channel to send question like this
Question : In Short
Question: Link
Approach: In Short
Code: Commented code link and please make sure it is properly indented and other readability issues are taken care of
That question is tough. Maybe many people are trying to solve it themselves first. I am stuck on it despite editorial since yesterday. Wait, people will help you (or not, that’s how things happen here LOL)