CodeChef is a non-commercial competitive programming community
Login
Username (New User? Signup) Password (Forgot Password?)
Signup
Login or
Signup with
Connect
Note
  • Publicize your achievements on your Facebook Wall.
  • Challenge your friends or ask them for help.

Site Navigation

  • PRACTICE
    • Easy
    • Medium
    • Hard
    • Challenge
    • Peer
  • COMPETE
    • All Contests
    • June Long 2012
    • May Cook-Off
    • May Long 2012
  • DISCUSS
    • Forums
    • Blog
    • Wiki
    • Facebook
    • Twitter
  • COMMUNITY
    • CodeChef Meetups
    • Campus Chapters
    • Host your Contest
    • User Groups
    • CodeChef TechTalks
    • All Educational Initiatives
  • HELP
    • Frequently Asked Questions
    • FAQ for problem setters
    • Problem Setting
    • Tutorials
    • Long Contest Ranks
    • Short Contest Ranks
    • Event Calendar
  • ABOUT
    • About CodeChef
    • Team CodeChef
    • Press Room
    • CodeChef Financials
    • CodeChef Sponsorships
    • CEO's Corner
    • Contact Us
    • About Directi
Home » Practice(HARD)
Try your hand at one of the practice
         problems, and submit your solution in the language of your choice
         (our judge accepts solutions in over 35+ languages). Receive points,
         and move up through the CodeChef ranks. Get better, and better prepare
         yourself for the competitions
  • Easy
  • Medium
  • Hard
  • Challenge
  • Peer
Name Code Successful Submissions Accuracy
Ordering the Soldiers ORDERS 157 6.13
Team Selection TEAMSEL 84 3.71
Some More Homework MARCHA6 31 27.21
Primes in the GCD table D4 27 8.78
XOR Rounds RESN02 26 13.93
The Guessing Game MARCHA3 22 15.92
Swapping mismatches C1 21 4.72
Authentication Failed AUTHEN 19 23.38
Divide and conquer F6 17 32.56
Travelling Salesman Again ! TSPAGAIN 16 60.94
Highways HIGH 13 15.79
Permutation Jumping RESN03 12 53.85
Baking Cupcakes MUFFINS 12 12.12
Bears and Bees BEARS 12 38.71
Bytelandian Shoppers BYTESHOP 12 32.43
Johny the farmer E3 12 12.5
Tidying Posters POSTERS 11 48.57
Haunted Maze HAUNTED 11 25
Digits Forest DIGFORST 11 21.51
Congruent triangles H3 11 19.77
Traffic jam N5 11 7.79
Se7en F4 10 2.71
Sine Partition Function PARSIN 9 47.62
Substrings on a Tree TSUBSTR 9 22.73
Card Shuffle CARDSHUF 9 10
Reaching the Rig REACHRIG 9 4.96
Milestones MSTONES 8 21.15
Buggy algorithm E5 8 57.14
Backup Functions FUNCTION 6 25
Reduce string STREDUC 6 8.2
Adding Least Common Multiples LCM 6 8.43
Product of Digits DIGITS 6 7.83
Lights Out DORADM01 6 37.5
The Hungry Bear HBEAR 6 24.14
Pruning Trees PRUNING 6 58.62
Ski Resort SKIRES 6 23.53
Sines Sum Queries SINSUMQ 6 9.68
The Reversed World REVERSED 5 9.46
Motorbike Racing M2 5 25
Rearranging Digits ARRANGE2 5 7.27
Genetics GENETICS 5 16.9
Little Elephant and Boxes LEBOXES 5 45.45
Graph Counting GRAPHCT 4 28.57
Sum Divides Product PRDIVSUM 4 4.35
Magic Strings J5 4 17.65
D-Power Permutations DPOWPERM 4 12.9
Help the judge J6 4 36.67
Product of Digits Again DIGITS2 4 38.46
Short SHORT 4 22.67
Can you do it better CYDB 4 6.78
Renting Spare Oven Time OVENTIME 4 19.44
Coloring in Hypercube HPARITY 4 41.67
Exponentiation Commutativity EXPCOMM 3 16.67
The Mine Field M1 3 33.33
Ciel and Random Walk CIELWALK 3 10.71
The Bytelandian Union A8 3 5.17
Generalized Independent Sets GENIND 3 40
Alien language G4 3 7.5
Wildcard Matching L2 3 21.51
Preferred Cooking Schools CKSCHOOL 3 18.52
Find a special connected block CONNECT 3 11.11
Alternating Permutations SNCK03 3 27.27
Chemical reactions G5 3 24
Misinterpretation 2 MISINT2 3 18.75
Ciel and Earthquake CIELQUAK 3 19.05
Something About Divisors DIVISORS 3 15
Find a Subsequence FINDSEQ 3 10
Falling Snow INSOMB8 2 42.86
Lame Queen Game LAMQUGAM 2 16.67
Billboards BB 2 50
Packing the Boxes A5 2 5.41
Toll Trolls M4 2 22.22
Alien Clock D7 2 13.04
Place the balloon L5 2 16.67
Even Coefficients EVENPOLY 2 100
Attack of the Clones CLONES 2 20
Lucky Days LUCKYDAY 2 5.71
A Christmas Pizza Puzzle A7 2 20
Powerful Strongholds SNCK02 2 28.57
Escape The Ruins ESCAPE 2 66.67
Heroes of Magical Might N2 2 66.67
Communicating Servers SERVERS 2 21.43
Buying Land BUYLAND 2 31.25
Minesweeper Reversed MINESREV 2 5.13
Short II SHORT2 2 25
Effective Sets J4 2 6.06
Generalized Spanning Trees GST 2 11.11
Yet Another Sequence YASEQ 2 40
Box Packers INSOMB4 2 22.22
Hypertrees HYPER 2 40
Algebra Express ACMKANPE 1 16.67
Ciel and Communications System CIELWEB 1 16.67
Divisors number divisibility DIVNODIV 1 4.44
Counting Hexagons CNTHEX 1 20
Colored Domino Tilings and Cuts DOMNOCUT 1 20
Rush Hour RUSHHOUR 1 16.67
Evil Book EVILBOOK 1 66.67
Get a Clue CLUE 1 50
Stepping Numbers STEPNUMS 1 1.92
Chef attic window WINDOW 1 9.68
Selling Tickets TICKETS 1 5.26
Post Office POST 0 0
Shortest Circuit Evaluation SHORTCIR 0 0
Flight Distance FLYDIST 0 0
The Archipelago ARCHPLG 0 0
Traffic Jam ACMKANPC 0 0
Harmonious Decorating HARMONY 0 0
Problem With Strings ACMKANPA 0 0
Lighting the shop LIGHTING 0 0
Frosting Cupcakes MUFFINS2 0 0
Chefs Game CHEF_GAM 0 0
Overlapping discs M5 0 0

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Programming Competition Fetching successful submissions
Directi Go for Gold

HELP

Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:

 

  • Accepted Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark.
  • Time Limit Exceeded Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach.
  • Wrong Answer Your program compiled and ran succesfully but the output did not match the expected output.
  • Runtime Error Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section.
  • Compilation Error Your code was unable to compile. When you see this icon, click on it for more information.
  • If you are still having problems, see a sample solution here.

CodeChef is a global programming communityCodeChef hosts online programming competitions
CodeChef is a non-commercial competitive programming community
  • About CodeChef
  • About Directi
  • CEO's Corner
  • C-Programming
  • Programming Languages
  • Contact Us
© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs
In order to report copyright violations of any kind, send in an email to copyright@codechef.com
CodeChef a product of Directi
The time now is:
CodeChef - A Platform for Aspiring Programmers

CodeChef was created as a platform to help programmers make it big in the world of algorithms, computer programming and programming contests. At CodeChef we work hard to revive the geek in you by hosting a programming contest at the start of the month and another smaller programming challenge in the middle of the month. We also aim to have training sessions and discussions related to algorithms, binary search, technicalities like array size and the likes. Apart from providing a platform for programming competitions, CodeChef also has various algorithm tutorials and forum discussions to help those who are new to the world of computer programming.

Practice Section - A Place to hone your 'Computer Programming Skills'

Try your hand at one of our many practice problems and submit your solution in a language of your choice. Our programming contest judge accepts solutions in over 35+ programming languages. Preparing for coding contests were never this much fun! Receive points, and move up through the CodeChef ranks. Use our practice section to better prepare yourself for the multiple programming challenges that take place through-out the month on CodeChef.

Compete - Monthly Programming Contests and Cook-offs

Here is where you can show off your computer programming skills. Take part in our 10 day long monthly coding contest and the shorter format Cook-off coding contest. Put yourself up for recognition and win great prizes. Our programming contests have prizes worth up to Rs.20,000 and $700lots more CodeChef goodies up for grabs.

Discuss

Are you new to computer programming? Do you need help with algorithms? Then be a part of CodeChef's Forums and interact with all our programmers - they love helping out other programmers and sharing their ideas. Have discussions around binary search, array size, branch-and-bound, Dijkstra's algorithm, Encryption algorithm and more by visiting the CodeChef Forums and Wiki section.

CodeChef Community

As part of our Educational initiative, we give institutes the opportunity to associate with CodeChef in the form of Campus Chapters. Hosting online programming competitions is not the only feature on CodeChef. You can also host a coding contest for your institute on CodeChef, organize an algorithm event and be a guest author on our blog.

Go For Gold

The Go for Gold Initiative was launched about a year after CodeChef was incepted, to help prepare Indian students for the ACM ICPC World Finals competition. In the run up to the ACM ICPC competition, the Go for Gold initiative uses CodeChef as a platform to train students for the ACM ICPC competition via multiple warm up contests. As an added incentive the Go for Gold initiative is also offering over Rs.8 lacs to the Indian team that beats the 29th position at the ACM ICPC world finals. Find out more about the Go for Gold and the ACM ICPC competition here.

Domain Name Registration, Web hosting, and Website Design provided by BigRock.com