How to solve SPOJ QTREE with centroid decomposition?
It's quite easy with HLD but I have no idea how to implement it so I went with centroid decomposition. Handling the max queries is relatively simple but I have no idea on how to to update. My idea is...
View ArticleCodigo2K17 :: KNIT Sultanpur
Greetings folks!We would like to inform that KNIT Sultanpur is back with its annual flagship Coding Contest Codigo2k17. Just like the previous iterations, this year's Codigo will be even more exciting...
View ArticleFCTRL2 getting wrong answer
import java.util.*;class RainBowa {public static void main(String a[]) { int n, t, fact; Scanner sc = new Scanner(System.in); t = sc.nextInt(); int ar[] = new int[t]; for (int i = 0; i < t; i++) {...
View ArticleHow to gain reputation in Codechef?
I am new to codechef so please any one guide to how to increase reputation?
View Articlecan u send me the logic to solve this question
There are N cities in a kingdom. These cities are aligned in a row. So, each city has two neighbours except first and last city. Each city has an F-number which denotes the maximum cities he can ask...
View ArticleINSQ15_F - Editorial
PROBLEM LINK:PracticeContestAuthor:vishfrndsTester:codefor6768Editorialist:vishfrndsDIFFICULTY:MEDIUMPREREQUISITES:dijkstra's algorithm basic graph theoryPROBLEM:Given a graph of N nodes. i-th node has...
View ArticleJULKA:spoj problem
can anyone please tell me what is wrong with this code..it give WA on spoj include<bits stdc++.h="">using namespace std; int main() { int l,m,t,i; char ta[101],ma[101]; int x[101],y[101]; for(int...
View ArticleHelp with this problem
https://www.hackerrank.com/contests/dyuthi-game-of-codes-2/challenges/nice-sequence I tried this problem during the contest but was able to pass only a few test cases.I tried solving it using dynamic...
View ArticleCan you please tell me why NZEC occurs?
public class Main{ public static void main (String[] args) throws java.io.IOException{ java.io.BufferedReader r = new java.io.BufferedReader(new java.io.InputStreamReader (System.in)); int n,k,t,c;...
View ArticleCHEFCH - Editorial
PROBLEM LINK:PracticeContestAuthor:Dmytro BerezinTester:Pushkar MishraEditorialist:Florin ChiricaPROBLEMYou're given a string of $+$ and $-$ symbols. A string is called a chain if it does not have two...
View Articlearray index 10^3 vs 1000
Hi Everyone,While I am trying to solve problem:Add two no's, I initialized the array to arr[10^3] (somewhere I have seen this way in an answer in codechef) and I was wondering that its not working. I...
View ArticleBalanced Brackets(stack implementation)
I wrote this code for the problem Balanced Brackets but I can't seem to know why it gives segmentation fault in some test cases.https://www.hackerrank.com/challenges/balanced-brackets/problemchar*...
View ArticleCS Academy Round #52 with Prizes
Hi all,I would like to invite you to CS Academy's next contest which takes place on Wednesday. There will be some money prizes awarded to the top 2 participants. You can find out more details on the...
View ArticleMerge Sort Tree - Tutorial
Prerequisites : Segment TreesTarget Problem : Given an array of N elements and you have to answer Q queries of the form L R K , To Count the numbers smaller than K in range L to R.Key Idea : The key...
View ArticleConcatenation of Strings C++
I recently came to know that the operator+ is overloaded in c++ to concatenate two strings but it is highly inefficient(Complexity: linear in terms of resulting string). I searched about it but could...
View ArticleMy answer is correct but the question does not accept it.
Question : CIELAB.import java.util.*;public class Main{public static void main(String []args) { Scanner sc=new Scanner(System.in); long a,b,x,d; a=sc.nextInt(); b=sc.nextInt(); x=a-b; d=x%10; x=x/10;...
View ArticleHow to know whether a problem passed all test cases in topcoder practice ?
I am a beginner. I have started coding in Topcoder. Now in arena after selecting a Div-2 200 point problem I submit it after 10 min. Then it says "submitting for 200 pt". Now I got somewhat 163 points....
View ArticleData Structures and Algorithms
Hi all, I need your help to make a list of most used data structures and algorithms along with their tutorials, implementation and some problems on them. It will be helpful to everyone in many ways. I...
View Articlewhat could be the most optimum way to check balanced parenthesis?
I have one string which can only have '(' and ')' ex: ((())) or ()()() now I want to check whether this parenthesis is balanced or not.static boolean isValidSequence(char []s){ char[] temp=new...
View ArticleACM ICPC Kolkata Kanpur site 2017
At the time of making Demand Draft for ACM ICPC Kanpur 2017, there is need of Bank Branch name and Bank Branch code. But, these informations are not provided anywhere. Can anyone help in finding the...
View Article