i got SIGSEGV in C++(gcc 4.3.2) but GOT AC in C++(gcc 4.8.1)
i got SIGSEGV in C++(gcc 4.3.2) but GOT AC in C++(gcc 4.8.1) for the problem PRIME GENERATOR http://www.codechef.com/problems/PRIME1These are my solutions : C++(gcc...
View ArticleGetting TLE in SPOJ problem
Hello.I am trying to solve following problem at SPOJ : http://www.spoj.com/problems/HORRIBLE/I am getting TLE at the first test case.If someone can help me to optimize my approach it will be a great...
View ArticleDirecti coding round
Is it possible to get the questions given in the recent Directi coding round (held on 09-02-2014) and possibly solutions any where?
View ArticleProblem in COLARR
What does this line signify in the problem "COLARR" in FEB14 Challenge..? "However Chef can do at most K repaintings".I have tried to solve this problem but getting a WA. One of my friend has solved it...
View Articlesubset with elements that are furthest apart from each other
I have an interview question that I can't seem to figure out. Given an array of size N, find the subset of size k such that the elements in the subset are the furthest apart from each other.Example:...
View Articlewrong answer in vertex cover http://www.spoj.com/problems/PT07X/
i am using max bipartite but i dont know what is wrong in my code ,my code is http://ideone.com/qN2zIU
View ArticleE1 - the white knight, WA
WA, on problem: http://www.codechef.com/problems/E1 my code: http://ideone.com/OWMH40#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using...
View ArticleCDCRFT14 SUBBXOR Editorial
PROBLEM LINK:ContestDIFFICULTY:MEDIUMPROBLEM:Given an array of positive integers and a number K, find the number of subarrays whose XOR is less than K. XOR of subarray is defined as XOR of all elements...
View ArticleTLE with memset()
i am not able to figure out why i got TLE with memset in http://www.codechef.com/FEB14/problems/LCPESY .However , on replacing memset(..., 0 , 256) by for(i=0;i<256;i++) i got AC .What is the reason ?
View ArticleCDZ14A - Editorial
PROBLEM LINKS:PracticeContestAuthor:sikander_nsitTester:sikander_nsitEditorialist:sikander_nsitDIFFICULTY:SIMPLE-EASYPROBLEM:Given a string consisting of three possible characters 'B', 'R' and 'G' find...
View ArticleEDITORIAL- Stable atoms CRANIUM 2014
LEVEL: Easy CONCEPTS: Graph theory, proof by construction Problem link http://www.codechef.com/CRNM2014/problems/CRANATOMLet the atoms be the nodes and bonds be the edges, then the compound represents...
View ArticleEDITORIAL-Changed coordinates CRANIUM 2014
Level: CakewalkConcepts: Basic GeometryProblem Link: http://www.codechef.com/CRNM2014/problems/CRANCRDJohny measures the distance between P1(x1,y1) and P2(x2,y2) as : D(P1,P2) = |x1 - x2| + |y1 – y2|A...
View ArticleCDZ14B - Editorial
PROBLEM LINKS:PracticeContestAuthor:sikander_nsitTester:sikander_nsitEditorialist:sikander_nsitDIFFICULTY:EASY-MEDIUMPROBLEM:Given string S and number L we had to find the number of valid passwords....
View ArticleCDZ14C - Editorial
PROBLEM LINKS:PracticeContestAuthor:sikander_nsitTester:sikander_nsitEditorialist:sikander_nsitDIFFICULTY:EASY-MEDIUMPROBLEM:Given a 2D matrix consisting of 0 and 1 find the shortest path from (1,1) to...
View ArticleEDITORIAL- Kejriwal ki Jhadu CRANIUM2014
Level: MediumConcepts: Greedy,Dynamic programming, hashingProblem link: http://www.codechef.com/CRNM2014/problems/CRANBROMThis one can be done in many ways. Here is an O(n) solution .Below I will...
View ArticleCDZ14D - Editorial
PROBLEM LINKS:PracticeContestAuthor:sikander_nsitTester:sikander_nsitEditorialist:sikander_nsitDIFFICULTY:MEDIUMPROBLEM:In this problem, we had to find the count of numbers between a range[R,L] such...
View ArticleCDZ14E - Editorial
PROBLEM LINKS:PracticeContestAuthor:sikander_nsitTester:sikander_nsitEditorialist:sikander_nsitDIFFICULTY:MEDIUMPROBLEM:In the problem we had to find the sum of the smallest k elements in the given...
View ArticleEDITORIAL- Crazy boy CRANIUM 2014
Level: MediumConcepts: Matrices, Permanent of matricesProblem link: http://www.codechef.com/CRNM2014/problems/CRANCBOYThe question asks you to determine the permanent of the matrix in disguise. It can...
View ArticleEDITORIAL- Crazy Girl CRANIUM 2014
Concepts: Z algorithm, String matchingLEVEL: medium-hardProblem Link:http://www.codechef.com/CRNM2014/problems/CRANGIRLWe can use the Z algorithm to solve this problem in O(|A|) time by running it on...
View ArticleWrong Answer, though my code is running absolutely fine! Please clarify.
I am participating in February Long Challenge and my code is given in the link below, it is running correctly and I've tested it with various inputs, though your compiler always marks it as 'Wrong...
View Article