Top mistakes of competitive programmers

Please note that this answer is dedicated to competitive programmers only, as well as some recommendations in it. Competitive programming is not about readability, but about being able to code and debug fast.And still, the mains problems that I've seen: laziness and do not caring about code style even a little. That's ok if your program gets Accepted on first try, but otherwise you're gonna have a bad time debugging it. In general. So, mistakes (all of them are real stories):
1)Focusing on easier and 'cooler' things (like using of bitwise operations a lot instead of straightforward mathmatical formulas) instead of making code simpler to read and debug. Not only for them, but for the one who will help them too.
2)Copy-pasting it all around. "We don't need no architecture, just a little hack here is not bad. Oh, and here is another one. And here. C'mon, I still can tell you how is this supposed to work, but it doesn't work somewhy, can you help me?". "Re-using same code and introduce extra parameter to make it behave little differently in two cases with a bunch of local ifs? Nah, let's just copy this 50-lines procedure and make changes in the new instance.".
3)Having global counters for local loops. Ex-Pascalists do this a lot more than others. Good luck having recursive calls with that.
4)Using global variables for passing parameters instead of, well, parameters. EVERYWHERE. Combine this with copy-paste and you get a monster. Like, if you have three big integers stored in arrays name A, B and C, what is the best way to write a procedure for subtracting one from another? Correct, you write two procedures: sab (subtracts B from A and writes result to C), sbc (subtracts C from B and writes result to A). Oh. My. God. Why don't you make it a pass-by-reference-parameter and one procedure instead of two?
5)Re-using same variable 'because I'm too lazy to declare another one'. So, in this half of program it means 'number of elements in the input' and in the another it serves like 'for' counter.
6)Naming ALL variables and arrays with single letter. For the sake of typing speed, of course. Like this: f[p2] = c, a[i++] = b;. It can be ok if they would be able to completely understand that and debug it by themselves, but, well, beginners are typically not the case.
No identation. At all. "Why do I need it, I'm gonna write this, get OK and noone will read this again ever?". "Oh, yeah, indentation, I'm gonna add this in my next solution, not in this, it's already too big for formatting". This applies to non-competitive programmers too. Thank God, we have Python especially for them :)
7)Concentrating on writing full solution at once, instead of splitting it into several smaller parts and debugging them one-by-one. "Would you mind looking at my 250-lines program which uses two algorithms? It doesn't work." - they ask. I ask: "Which part of your program does not work?". They answer: "I don't know, I've just compiled it and it gives wrong answer". Please, split writing code in small steps, so you can be somehow sure about previous code when writing next.
8)Trying to go and solve IOI problems 'for training purposes' without enough practice. Imho, it's much better to save this problem for the time of actual IOI training, and start with easier ones - there are a plenty of good problems for beginners, that are interesting and challenging.
Courtesy:Quora

Comments

  1. I guess this is why we don't take 'competitive programmers' seriously in job interviews!

    ReplyDelete
  2. Good blog Bro. I hope It would help me enhanching my programming knowledge.

    ReplyDelete
  3. You're welcome,please share this blog :)

    ReplyDelete
  4. เชิญเพื่อนฝูงมาเล่นสล็อตออนไลน์ที่ Pussy888
    เหตุผลที่คนตัดสินใจเข้ามาเล่นสล็อตออนไลน์นั้นมีหลายเหตุผลไม่เหมือนกันออกไปโดยส่วนมากแล้วผู้ที่ตั้งอกตั้งใจจะเข้ามาเล่นนั้นจะเข้ามาเล่นเพราะเหตุว่าความต้องการอยากจะรู้อยากจะเห็นรวมทั้งต้องการทดลองเป็นส่วนมาก แม้กระนั้นก็มีคนจำนวนไม่น้อย ที่เข้ามาเล่นเนื่องจากว่าอยากได้เงินและก็อยากได้ผลกำไร แล้วก็มีผู้เล่น อีกผู้คนจำนวนไม่ใช้น้อยที่ได้เข้ามาเล่นสล็อตออนไลน์เพราะเหตุว่าเล่นตามเพื่อนพ้องหรือมองเห็นบุคคลอื่นเล่นและก็ต้องการทดลองเล่นตาม การเล่นสล็อตออนไลน์นั้นมีจุดเด่นมากยิ่งกว่าจุดบกพร่องอย่างแน่แท้หากแม้ผู้คนจำนวนมากจะโต้แย้งแล้วก็เห็นว่ามันเป็นการพนันจะมีจุดเด่นมากยิ่งกว่าข้อบกพร่องได้ยังไง แม้กระนั้นขอให้มองดูในรูปภาพรวมว่าแม้การเข้ามาเล่นสล็อตออนไลน์โดยเน้นความสนุกความบันเทิงดวงใจเป็นหลักหรือตัดความคาดหวังจากการเล่นเพื่อเอาเงินสิ่งเดียวออกไปการเล่นสล็อตนั้นก็ถือได้ว่าเป็นความบันเทิงอย่างหนึ่งที่เหมาะสมกับการใช้เวลาว่างสำหรับในการเล่นทีเดียว
    เชิญชวนเพื่อนฝูงมาเล่นสล็อตออนไลน์ที่เว็บไซต์ Pussy888 ได้อย่างไม่ยากเย็น
    สำหรับคนใดที่เล่นสล็อตออนไลน์อยู่กับเว็บไซต์ Pussy888 อยู่แล้วนั้น และก็ปรารถนาชักชวนเพื่อนฝูงอีกผู้คนจำนวนมากเข้ามาเล่นเกมสล็อตออนไลน์ในเว็บไซต์เดียวกัน วันนี้ทุกการเชิญชักชวนจะไม่เสียเปล่าเมื่อทางเว็บ Pussy888 ได้มีการออกโปรโมชั่นมอบโบนัสพิเศษให้กับสมาชิกที่มีการชักชวนเพื่อนฝูงเข้ามาเล่นในเว็บไซต์เดียวกันโดยจะมีการมอบโบนัส 10% ต่อการเชิญชวนสหาย 1 คน ยิ่งพวกเราเชิญเพื่อนพ้องมากมายพวกเราก็ยิ่งได้โบนัสเยอะขึ้นและก็โบนัสที่พวกเราได้ ก็นำไปเป็นเครดิตให้ตนเองเล่นเกมถัดไปได้ในทันที

    Pussy888 เล่นได้ถอนได้จริงแน่ๆ
    เกมสล็อต pussy888 เป็นเกมส์สล็อตที่เหมาะกับมือใหม่ฝึกหัดเล่น บางครั้งอาจจะยังไม่รู้เรื่องในกรรมวิธีการเล่น หรือบางครั้งก็อาจจะยังมองไม่เห็นว่าเล่นแล้วได้เงินเช่นไร วันนี้เว็บไซต์ของพวกเราจะเสนอแนะแนวทางการเล่นเพิ่มเพื่อได้เงิน สำหรับผู้ที่เงินลงทุนสำหรับเพื่อการเล่นน้อยนั้น สิ่งแรกก็คือ การเลือกพนันทีละไม่มากมาย สมาชิกจึงควรเลือกห้องสำหรับเพื่อการพนันเป็นห้องหลักสิบ ลงทุนพนันทีละ 20 บาท ควรจะต้องได้กำไรขั้นต่ำ 500 – 600 บาท เมื่อได้ตามแผนการที่วางไว้แล้ว เสนอแนะสมาชิกเพิ่มเงินเดิมพนันขยับขึ้นไปเป็น 50 บาท เมื่อขยับยอดเงินลงทุนแล้วได้ยอดตามวัตถุประสงค์ เสนอแนะสมาชิกหยุดการเล่นหรือเบิกเงินออกและก็เพิ่มเติมเงินเข้ามาใหม่อีกที นี่เป็นเคล็ดวิธีดีๆสำหรับการเล่นที่พวกเราตระเตรียมไว้เพื่อสมาชิก เดี๋ยวนี้สามารถเข้าเล่นผ่านหน้าเว็บไซต์ได้แล้วทุกระบบ และก็พิเศษสุด สามารถเพิ่มเติมผ่านทรูวอเลทได้ สมัคร Pussy888 ฟรีเครดิต ได้แล้วที่เว็บไซต์ พุซซี่888 เพียงแค่นั้น
    918kiss
    สล็อต

    ReplyDelete
  5. มาสมัครเล่นกับเว็บsaking789 จะมัวช้าอยู่ทำไมล่ะ

    ReplyDelete

Post a Comment

Popular posts from this blog

Good schedule to follow for becoming better at competitive programming for beginners

Forget Efficiency and start solving easier problems

How to study CLRS?