Logic needed with explanation.
Hi I need to come up with a solution for the following problem. Tell me how to code in C?Input:1 2 3 4 Output:1 2 3 4 4 1 2 1 3 4 3 2 2 1 4 3
View ArticleHOLES wrong answer?
#include<stdio.h> #include<string.h> int main() { int t,i,count=0; char str[1000]; scanf("%d",&t); while(t>0) { scanf("%s",str); for(i=0;i<strlen(str);i++) { if(str[i]=='A' ||...
View ArticleNeed help for MAXCOUNT problem
I went through the editorial as well as other threads,my code satisfies all the test cases present in the problem page as well forum messages,hence this thread....
View ArticleHacker Earth question similar to flipcoins
Recently in Hacker Earth's Angel prime hiring challenge there is a question which is similar to flipcoins but Im unable get a working algorithm please help me . I dont need the code just give me a...
View Articlehard : The Guessing game ::: Can someone help me getting out of this ? My...
My code is giving current answer but i dont know why it is not accepting it and giving runtime(NZEC) error, followimg is the link to my code: http://www.codechef.com/viewsolution/3134167
View ArticleSolving Range Minimum Queries using Binary Indexed Trees (Fenwick Trees)
Formally, the Range Minimum Query Problem is:Given an array A[0, N-1] , Find the position of the element with the minimum value between any two given indices.Now, the standard solution is to use a...
View ArticlePPTEST - Editorial
PROBLEM LINKS:PracticeContestAuthor:Vitaliy HerasymivTester:Tasnim Imran SunnyEditorialist:Tuan AnhDIFFICULTY:EasyPREREQUISITES:Dynamic ProgrammingPROBLEM: There are N questions. The ith question needs...
View ArticleCANDLE - Editorial
PROBLEM LINKSPracticeContestDIFFICULTYEASYEXPLANATIONThe answer will always be either a repdigit (a number composed of repeated instances of the same digit) or a power of 10. We find the smallest power...
View Articlewhat is happening in while loop of linked list traversing program??
struct node { int info; node *link; }; int main() { node a[100]; node *start=&a[1]; int n,i,item; cout<<"Enter No. of Nodes in Linked List : "; cin>>n; cout<<"\nEnter Info of...
View ArticleWA in KINGCON
I was trying to solve this simple problem but unfortunately my answer isnt coming right http://www.codechef.com/problems/KINGCON. Here is my code http://ideone.com/1G9qVs . I am trying to implment the...
View ArticleHELP IN COMBINATORICS
Hey guys, i need help in combinatorics, can anyone suggest me any good book for combinatorics or some tutorial online ?? and some basic problems to solve in combinatorics !! I'd be glad if anybody can...
View ArticleWA in knapsack problem.
problem link: http://www.spoj.com/problems/PARTY/my solution: http://ideone.com/1DbuAFProblem is,I'm getting a different(least possible) value for the sum of entrance part for the same optimal...
View ArticleCode Review
I am trying to solve this problem on CodeForces. I came up with a solution and submitted it. However it is showing wrong answer on both testcases though it works completely fine on my system. Is...
View ArticleCube cakes question(dec 2013 challenge)
1.Can anybody explain me this question http://www.codechef.com/problems/CUBE2.Also suppose input: 1 3 100 abcdefghijklmnopqrstuvwxyza abcdefghijklmnopqrstuvwxyzx o/p: 2 7 How?
View ArticlePlease correct my implementation of Binary Indexed Tree
I am getting RTE with this code http://www.codechef.com/viewplaintext/3150374 I think there's something wrong with my implementation. I studied BIT from here :...
View ArticleNZEC error in python
n,k=map(int,raw_input().split()) arr=[0]*k z=0 for i in xrange(0,k): s1=str(raw_input()) if s1.lower()=="closeall": arr=[0]*k z=0 else: if arr[int(s1[5])-1]==1: arr[int(s1[5])-1]=0 z-=1 else: z+=1...
View Articlehow to solve funny marbles by BIT (Fenwick trees)
I confess that i have not at all being able to get binary indexed trees. I browsed through number of tutorials(topcoder,codeforces,etc)but i didn't get it still.It would be great if someone can explain...
View ArticleACMKANPA problem (detecting knots on a string)
Does anybody knows if it is possible to have any information about this problem? It's in the practice -> hard section. I've made some submission which wheren't accepted and since many others also...
View ArticleDECORATE - Editorial
Given a string S, the problem first requires you to compute the set of all unique palindromes of the string. This is part one of the problem. For example, given the string "abab", the set of all unique...
View Article