Understanding Unsolvable Problem
Total Page:16
File Type:pdf, Size:1020Kb
Olympiads in Informatics, 2016, Vol. 10, 87–98 87 © 2016 IOI, Vilnius University DOI: 10.15388/ioi.2016.06 Understanding Unsolvable Problem Jonathan Irvin GUNAWAN Undergraduate Student School of Computing, National University of Singapore Computing 1, 13 Computing Drive, Singapore 117417 e-mail: [email protected] Abstract. In recent IOIs, there are several problems that seem unsolvable, until we realise that there is a special case to the problem that makes it tractable. In IOI 2014, the problem ‘Friend’ appears to be a standard NP-hard Maximum Independent Set problem. However, the graph is gen- erated in a very special way, hence there is a way to solve the problem in polynomial time. There were several contestants who didn’t identify the special case in this problem, and hence were stuck at the problem. In this paper, we will study a well-known technique called reduction to show that a problem we are currently tackling is intractable. In addition, we introduce techniques to identify special cases such that contestants will be prepared to tackle these problems. Keywords: special case, unsolvable, NP-hard. 1. Introduction The problem ‘Friend’ in IOI 2014 required contestants to find a set of vertices with maxi- mum total weight, such that no two vertices in the set are sharing a common edge. This is a classical Weighted Maximum Independent Set problem. We can show that Weight- ed Maximum Independent Set problem is NP-hard by reduction from 3-SAT (Cormen et al., 2009). Since the formulation of NP-completeness 4 decades ago, no one has been able to propose a solution to any NP-hard problem in polynomial time. Clearly, it is not expected that a high school student can solve the problem in 5 hours. None of the Indo- nesian IOI 2014 team solved this problem during the contest. After returning from the competition, I asked the Indonesian team about this problem. None of the team members were aware of the fact that Maximum Independent Set is an NP-hard problem, and thus were stuck trying to solve a general Maximum Independent Set problem. A similar problem also occurred in IOI 2008. The problem ‘Island’ required contes- tants to find a longest path in a graph with 1,000,000 vertices. The longest path problem is a classic NP-hard problem which can be reduced from the Hamiltonian path problem. If a contestant is not aware that the longest path problem is difficult to solve, the con- testant may spend a lot of his/her time just to tackle the general longest path problem, without realising that there is a special case to the given graph. 88 J.I. Gunawan Generally, some contestants spend too much thinking time trying to solve something that is believed to be unsolvable. If only they realise that their attempt is intractable, they may try a different approach and find a special case of this problem. In section 2 of this paper, we will introduce a classic reduction technique often used in theoretical computer science research. In the context of competitive programming, we may find out that a problem which we are attempting is unlikely to be solvable. After realizing that a problem is intractable, we are going to discuss how to proceed to solve the problem in section 3. Finally, in section 4 we will take a look at some common special cases in competitive programming that can be used to solve these kind of problems. Fig. 1. The result of Indonesian team in IOI 2014, taken from http://stats.ioinformat- ics.org. The red squared column highlights the ‘Friend’ problem. Fig. 2. IOI 2014 tasks statistics, taken from http://stats.ioinformatics.org. ‘Friend’ problem is the second least accepted problem in IOI 2014. It may be because some contes- tants (at least all the Indonesians) were stuck at trying to solve a general case of Maximum Independent Set. Fig. 3. The result of Indonesian team in IOI 2008, taken from http://stats.ioinformat- ics.org. The red squared column highlights the ‘Island’ problem. Understanding Unsolvable Problem 89 2. Identifying Intractability of a Problem through Reduction 22 Identifying Identifying Intractability Intractability of of a a Problem Problem through through Reduction Reduction 22 Identifying Identifying Intractability Intractability2 Identifying2 Identifying of of Intractability a a Problem Problem Intractability through through of a Problem Reduction Reduction of a through Problem Reduction through Reduction 2 Identifying Intractability2 Identifying of a2 Problem Identifying2 Intractability Identifying through IntractabilityWe would Intractability of Reduction22 alike Identifying ProblemIdentifying to know that of the a through of problem Problem Intractability Intractability a Problem that we Reduction throughare attempting through of of is Reduction aunlikely a Problem Problem Reduction to have an through through Reduction Reduction 2 Identifying Intractability22 Identifying Identifying of Intractability Intractability a Problem2 through Identifying of of a a Problem Problem Reduction IntractabilityWeWe would throughwould through like like to to know know Reduction Reduction that that of the the a problem problem Problem that that we we are are through attempting attempting is is Reduction unlikely unlikely to to have have an an immediate immediate solution. solution. The The 2 Identifying Intractability of a Problem through ReductionWeWeimmediate would would like like solution. to to know know The that that most theWe the common problem would problem like way that that to is we know weto are apply are that attempting attempting a thewell-known problem is is unlikely unlikely thattechnique we to to haveare havecalled attempting an an immediate immediate is unlikely solution. solution. to haveThe The an immediate solution. The We would like to know that the problem2We that would Identifying we are like attempting to know that isWe Intractability unlikely the would problem to like have to that know an we immediate thatare of attempting theWeWe a solution.problem would would Problem is like like that unlikely The to to we know know areto through have thatattempting thatmostmost anthe the immediate common problemcommon problem is Reduction unlikelyWe that waythat wouldway solution. toweis weis liketo have to are are apply applyThe to attempting attempting an know immediate a a well-known well-known that is is the unlikely unlikely solution. problem technique technique to to The have havethat called called anwe an immediate areimmediate reduction. reduction. attempting solution. solution. Suppose Suppose is unlikely The The we we toknow know have that that an problemimmediate problem X X solution.is is The We would like to know thatmost themostreduction. problem common commonWe wouldSuppose that way way like we is we is are toto know knowapply attempting applymost that that a a well-known problem common well-known the is unlikely problem X way technique is technique to isthatimpossible have to we apply calledan are called immediateto a attempting solve, well-knownreduction. reduction. and solution. iswe Suppose technique unlikely Supposealso Theknow to we wecalled have know know an reduction. that immediatethat problem problem Suppose solution. X X is is we The know that problem X is We would like to know thatWeWe the would would problem like like that to to know know we are that that attempting the the problem problem is unlikely that that we we to are are have attempting attempting an immediate is is unlikely unlikely solution. to to have have The an anmost immediate immediate common solution. solution. way is1 toThe The apply a well-known technique called reduction. Suppose we know11 that problem X is We wouldmost like commonto know that way the is to problem apply a that well-known wemost are attempting techniquecommon way iscalled unlikely is to reduction. applymost to have commona well-known Suppose an immediate way we techniqueis know tothat solution. apply we thatmost most calledcan a problem The well-known solve common common reduction. problem X is way way technique Suppose is isX to toby apply applyimpossibleimpossible calledusing we aknow aproblem reduction. well-known well-known to to that solve, solve, Y problem Supposeas andtechnique andtechnique a black-box we we X also alsowe is called called know know. Ifreduction. reduction. thatwe that can weproblem we cansolve can Suppose Suppose solve solve X is problem problem we we know know X X11 1 by by that that using using problem problem problem problem X X Y is Y is as as a a black-box black-box1 .. If If we we can can most common way is to applyimpossibleimpossibleimpossible a well-knownmost to to to solve,common solve, solve, technique and and and way we we we also also is alsoimpossible called to know know knowapply reduction. that that thata to well-known wesolve, we we can can Supposecan and solve solve solve we technique problem problem alsowe problem know know X Xcalled Xthat by by that by using using usingreduction.problem we can problem problem problem solve X Suppose is Y Y problem Y as as as a a a black-box black-box we black-box X knowby using.. that. If If Ifproblem we we weproblem can can can Y as X ais black-box . If we can 1 most common wayWe is towould applymostmost like a tocommon commonwell-known know that way way technique the is is to to problem apply apply called a athat well-known well-known reduction. we are attempting technique technique Suppose1 iswe called called unlikely know reduction. reduction. that to have problem Suppose Supposean immediate X is we weimpossible know know solution.1 that that toproblemThe solve,problem and X X we is is also know1 that we can solve problem11 X by using problem Y as a black-box . If we can most commonimpossible way to is solve, to apply and a we well-known also know technique thatimpossible we can called solve to solve, reduction.