Programming Links
Programming Links
http://www.iarcs.org.in/inoi/onlinestudymaterial/topics/index.php
AlgorithmsExplanationwithComplexityTutorials:
http://www.daqwest.com/
DSandAlgoIndex:
https://discuss.codechef.com/questions/48877/datastructuresandalgorithms
Problemsbasedoncategory
http://www.ahmedaly.com/Category.jsp?ID=33
DP:
1.
https://www.codechef.com/problems/COUPON
http://pastebin.com/QYCX9ujN
2.
http://pastebin.com/5yX3ivjy
https://www.codechef.com/problems/SPIDY2/
3.
http://www.spoj.com/problems/SQRBR/
http://pastebin.com/mwq47v0H
4.
http://www.spoj.com/problems/PERMUT1/
http://pastebin.com/wNuquV1V
5.
http://www.spoj.com/problems/GNYR09F/
http://pastebin.com/2tBcRRcx
6.
http://codeforces.com/contest/467/problem/C
7.
http://codeforces.com/blog/entry/325
https://open.kattis.com/contests/nwerc14open/problems
https://www.youtube.com/playlist?list=PLOXhSOGFEiqILYZudFr9ro9AmJhx8tIA
https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=343
https://docs.google.com/file/d/0B8jkfQFfgLYXMzIzOWU3ZWItNzRmYy00NmNjLTgyZjktM2Y3Nj
dlMWQzMTA2/edit?ddrp=1&pli=1&hl=en
Trie
https://threadsiiith.quora.com/TutorialonTrieandexampleproblems
http://www.spoj.com/problems/PHONELST/
http://www.spoj.com/problems/PRHYME/
http://codepad.org/VsrAiJpV
(PHRYMESolution)
SegmentTree
https://discuss.codechef.com/questions/38770/lazypropagation
http://www.spoj.com/problems/HORRIBLE/
https://www.codechef.com/problems/CHEFD
http://ideone.com/JWh9Qx
(HORRIBLESolution)
https://www.codechef.com/viewplaintext/4923123
(CHEFDSolution)
FenwickTreeakaBinaryIndexedTree(BIT)
http://community.topcoder.com/tc
http://sanugupta.wordpress.com//binaryindexedtreefenwi/
Problem(s):
http://www.codechef.com/problems/MBOARD
http://www.spoj.com/problems/RANGESUM/
Solution(s):
http://pastebin.com/V9bcMNt0
(RANGESUM)
http://pastebin.com/DHjhuD4p
(MBOARD)
ProblemSet3
1)
http://www.spoj.com/problems/FARIDA/
2)
http://www.codechef.com/problems/COINS
3)
http://www.spoj.com/problems/BEHAPPY/
4)
http://community.topcoder.com/stat
5)
http://www.codechef.com/problems/DELISH
6)
http://www.codechef.com/problems/FROGV/
7)
http://www.spoj.com/problems/EDIST/
8)
http://www.spoj.com/problems/WACHOVIA/
9)
http://codeforces.com/contest/455/problem/A
Solutions:
1)FARIDA:
http://pastebin.com/X2c6jyY1
2)COINS:
http://pastebin.com/2kg5gw29
3)BEHAPPY:
http://pastebin.com/HyY4nVCs
4)ZigZag:
http://pastebin.com/SiA8Z8rz
5)DELISH:
http://pastebin.com/qtnQMwif
6)FROGV:
http://www.codechef.com/viewplaintext/4183317
7)EDIST:
http://pastebin.com/d7pVRMcd
8)WACHOVIA:
http://pastebin.com/yUqUFKHs
9)Boredom:
http://pastebin.com/t895hYhg
ProblemSet4
1)
http://www.spoj.com/problems/MFISH/
2)
http://www.codechef.com/problems/LEPAINT/
3)
http://www.codechef.com/problems/SEATSR/
4)
http://www.spoj.com/problems/INS14E/
5)
http://www.spoj.com/problems/MARTIAN/
6)
http://community.topcoder.com/stat
7)
http://www.codechef.com/problems/LEBLOCKS
8)
http://www.codechef.com/problems/LEMOVIE
9)
http://www.codechef.com/problems/LEMAGIC
10)
http://www.codechef.com/problems/LECOINS
Solutions:
1)MFISH:
http://pastebin.com/vc7SwrQ4
2)LEPAINT:
http://pastebin.com/11Dj5bxH
3)SEATSR:
http://pastebin.com/wW2sfNWA
4)INS14E:
http://pastebin.com/3xEYefg7
5)MARTIAN:
http://pastebin.com/8eDpF5Zd
6)VocaloidsAndSongs:
http://pastebin.com/Tng63sfW
7)LEBLOCKS:
http://pastebin.com/MKyZcMXF
8)LEMOVIE:
http://pastebin.com/w2dCL5fy
9)LEMAGIC:
http://paste.ubuntu.com/9933878/
AdvancedDynamicProgramming
ForReading
CommonlyUsedDPstatedomains:
http://apps.topcoder.com/forums/
GeneralAspectsofDP:
http://apps.topcoder.com/forums/
OptimizingDPsolutions:
http://apps.topcoder.com/forums/
DynamicProgrammingOptimizations
ConvexHullTrick1:
http://wcipeg.com/wiki/Convex_hull_trick
Problem(s):
http://codeforces.com/contest/319/problem/C
DivideandConquerOptimization:
http://codeforces.com/contest/321/problem/E
https://www.hackerrank.com//chall/guardianslunaticsioi14
(Solveproblemswiththehelpof
editorialtolearn)
ConvexHullTrick2:
http://apps.topcoder.com/forums/
Problem(s):
http://www.spoj.com/problems/NKLEAVES/
http://codeforces.com/contest/311/problem/B
DigitDP
http://stackoverflow.com//howtocountintegers/22394258
http://codeforces.com/blog/entry/8221
Problem(s):
http://www.codechef.com/problems/ANUBGC
http://www.spoj.com/problems/LUCIFER/
http://www.spoj.com/problems/RAONE/
http://www.spoj.com/problems/GONE/
DPontrees
http://www.iarcs.org.in//onlinestudy/topics/dptrees.php
Problem(s):
http://www.spoj.com/problems/PT07F/
https://www.spoj.pl/problems/PT07X/
http://www.spoj.pl/problems/VOCV/
BitmaskDP
http://community.topcoder.com/tc
Problem(s):
http://www.codechef.com/problems/TSHIRTS
http://usaco.org/index.php?page=viewproblem2&cpid=515
http://www.spoj.com/problems/HIST2/
Solutions:
TSHIRTS:
http://www.codechef.com/viewplaintext/5234719
HIST2:
http://pastebin.com/fxhdrmv0
GONE:
http://pastebin.com/P5uejHN3
RAONE:
http://pastebin.com/r8R2n6v0
LUCIFER:
http://pastebin.com/MSpNQtUt
ANUBGC:
http://pastebin.com/u7MUp8TP
PT07X:
http://pastebin.com/YjgstWQH
Contest1
:BalticOlympiadinInformatics2010Day1
1.Problems:
http://www.ut.ee/boi/?item=boi.tasks.1
2.TestData:
http://www.ut.ee/boi/?item=boi.tasks.tests
3.Solutions:
http://www.ut.ee/boi/?item=boi.tasks.sol
Contest2
:ArabandNorthAfricaRegionalContest2009
1.Problems:
https://icpcarchive.ecs.baylor.edu/index.php
3.Solutions:
https://docs.google.com//0B8jkfQFfgLYXMzIzOWU3ZWItNz/edit
#
Ifyouwantyoucanmaketeamswithatmost2otherpeople.Thecontestwasof5hourssotry
tosolvealltheproblemsfor5hoursonlyafterthatreadthesolutionsandsolveatleast56
problemsoutofthe10.Ifyouaredoingitaloneyoucanraisethetimelimitifyouwantjustdon't
raiseittoomuch.
Contest3:
USACO2014JanuaryContestSilverDivsionDiscussionThread:
Solutions:
http://usaco.org/index.php?page=jan14problems
SourceCodesbySameerGulati:
1)
http://pastebin.com/ySKYKaSB
2)
http://pastebin.com/9sB8pLJN
3)
http://pastebin.com/WBWCNLrj
Contest4
CodechefJanuaryLongChallengeUpsolvingThread
SameerGulatisSolutions:
1)GCDQ:
http://www.codechef.com/viewsolution/5680755
2)QSET:
http://www.codechef.com/viewsolution/5698266
3)CHEFSTON:
http://www.codechef.com/viewsolution/5679575
4)CLPERM:
http://www.codechef.com/viewsolution/5719287
5)ONEKING:
http://www.codechef.com/viewsolution/5684461
6)XRQRS:
http://www.codechef.com/viewsolution/5703145
7)SEAVOTE:
http://www.codechef.com/viewsolution/5684096
http://discuss.codechef.com/questions/48877/datastructuresandalgorithms
NumberTheoryProblems
LCMandGCD
Euler'sFunction
ModulusArithmetic
1.EXGCDMedium[
http://www.codechef.com/COOK29/problems/EXGCD
]
2.DIV2SPOJ[
http://www.spoj.com/problems/DIV2/
]
3.SEAGCDMedium[
http://www.codechef.com/problems/SEAGCD
]
4.DIVSUMSPOJ[
http://www.spoj.com/problems/DIVSUM/
]
5.GCDEXSPOJ[
http://www.spoj.com/problems/GCDEX/
]
6.LCMSUMSPOJ[
http://www.spoj.com/problems/LCMSUM/
]
7.ODDDIVSPOJ[
http://www.spoj.com/problems/ODDDIV/
]
8.IITK2P05FACTORIZATION[
http://www.codechef.com/problems/IITK2P05
]
9.LCMChallengeCF[
http://codeforces.com/problemset/problem/235/A
]
10.GCDDetereminantHARDSPOJ[
http://www.spoj.com/problems/MSE08H/en/
]
11.NDIVPHI2SPOJ(Euler'sTotientfunction)[
http://www.spoj.com/problems/NDIVPHI2/
]
12.ModifiedGCDCF[
http://codeforces.com/problemset/problem/75/C
]
13.PrimeProblemUVA[
https://uva.onlinejudge.org/index.php
]
14.FombinatorialCodeChefEASY[
http://www.codechef.com/problems/POWERMUL
]
15.TotientpermutationProjectEuler[
https://projecteuler.net/index.php?section=problems&id=70
]
GraphTheory
StronglyConnectedComponents
Tarjan'sAlgorithm:
http://www.geeksforgeeks.org/tarjanalgorithmfindstrongl/
Kosaraju'sAlgorithm:
http://www.geeksforgeeks.org/stronglyconnectedcomponents/
Problems:
http://www.spoj.com/problems/WEBISL/
http://www.spoj.com/problems/BOTTOM/
http://www.spoj.com/problems/TPCPPLAR/
solution:WEBISL:
http://pastebin.com/tKwRTJta
by
MarinKii
http://pastebin.com/nPrDaeZM
byme
BOTTOM:
http://pastebin.com/eaWyc5Gh
Problem1
.
http://community.topcoder.com/stat?c=problem_statement&pm=13784
(Div21000)
SolnIdea:
HINT
:
letssaywehave3vertex,u,v,w.
d(u,v)=d(u,w)+d(w,v)(mod2)(thisequationalwayssatisfies).Itmeansparitydoesnot
change.
So,ifdistancerelationofonevertexvalidatestheinputrelationwitheveryothervertex,thenall
pairofvertexsatisfiesthegiveninputdistancerelationMatrix.So,treeisvalid.
Linktocode:
http://ideone.com/RhkRQh
.Pretestpassed.Systemtestingpendingastopcoder
isnotworkingcurrently.
Problem2
.
http://community.topcoder.com/stat?c=problem_statement&pm=13774
(Div21000)
SolnIdea:
Youcannotsolvethisproblemwithoutchineseremaindertheorem.
Hint
:RequiredChineseRemainderTheorem(
CRT
)
Usingchinesetheorem,ifX%n1=a1,X%n2=a2,..,X%nk=akandGCD(ni,nj)=1,i!=j.then
wecancalculate(X%N)ink*log(N),whereN=n1*n2**nk.
Weneedtocheckforx<10^9asf(x)%10^9isgiven.10^9=2^9*5^9.
Idea:N=10^9,n1=2^9,n2=5^9.N=n1*n2,GCD(n1,n2)=1
AswehavetofindtheXsuchthatf(X)%10^9=0wheref(x)=ax^2+bx+c.soifweareableto
findx2andx5suchthatf(x2)%2^9=0andf(x5)%5^9=0,wearedone.Mergebothx2andx5
usingCRTtheoremtogettheX%10^9.(DirectcodeavailableforCRTorReadWikipediafor
CRT).
Linktocode:
Ideone.com
.Pretestpassed.Systemtestingpendingastopcoderisnotworking
currently.
(topic:maths)
Problem3:
http://community.topcoder.com/stat?c=problem_statement&pm=13720
(Div21000)
SolnIdea:
ThisproblemcanbesolvedusingDPapproach.
dp[i][mod1][mod2][mod3][mod4][mod5].Assumen=5whichmeanswehave5Questionsand
weareatithdigit(traversefromi=0towardsi=m1),now,
dp[i][mod1][mod2][mod3][mod4][mod5]willstorethenumberofwaysofdifferentMdigitnumber,
whereremainderfor1stquestiontilli'thdigitismod1,remainderfor2ndquestiontilli'thdigitis
mod2andsoon.assumeadigit=1isatithplace,andcalculatetheabovedp.
Transitionforthiswillbe:
dp[i][mod1][mod2][mod3][mod4][mod5]+=dp[i1][mod11][mod21][mod31][mod41][mod51]
Now,dothisforeverydigit,from0to9.
Note:Weneedtocheckifdigitatithplaceisallowedforjthquestiontomakethetransition
accordingly.(Givenintheinputitself)
LinktoCode:
Ideone.com
.Pretestpassed.Systemtestingpendingastopcoderisnotworking
currently.complexity:O(10^n*n*m*10)
topic:
DP
Problem4:
http://community.topcoder.com/stat?c=problem_statement&pm=13699
(Div1500,
Div21000)
SolnIdea:
ThisproblemcanbesolvedusingSegtreestructure.whenwegetaqueryto
changethevalueataposition,updatethesegmenttree.Ateachnodeofsegmenttree,store
theanswerfor0pair,1pairand2pair.Weneedtostoresomeextravariableswhichhelpsin
computationof(0pair,1pairand2pair)totheparentnode.
LinktoCode:
http://ideone.com/zmt6x4
.Pretestpassed.Systemtestingpendingastopcoder
isnotworking
file:///C:/Users/panchasankar/Downloads/I++%20OLPC%20Editorials.pdf