I am stuck on this following problem for a pretty long time.
It will be really helpful if you can provide me with a solution.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
I am stuck on this following problem for a pretty long time.
You are given an array of $$$N$$$ integers. All the numbers are distinct and between $$$[1...N].$$$
You will be given two integers, let’s call them $$$L, R (1 ≤ L ≤ R ≤ N).$$$ You need to find out the length of the largest contiguous sub-array of the given permutation in which every value is between $$$L$$$ and $$$R$$$ inclusive. You will be given many queries like this for the given array.
The first line contains two integers $$$N$$$ and $$$Q (1 ≤ N, Q ≤ 10^5)$$$, size of the array and the number of queries. Then the next line contains a permutation of positive integers between $$$1...N.$$$ The next $$$Q$$$ lines contain pairs of integers: $$$L$$$ and $$$R.(1≤ L≤ R≤ N)$$$
Print $$$Q$$$ lines, each line should contain the length of the largest sub-array of the array which contains all the values only from $$$[L, R]$$$ (inclusive).
6 3
1 5 2 3 6
1 5
1 4
3 4
4
2
1
$$$2s$$$
It will be really helpful if you can provide me with a solution.
I am stuck on this following problem for a pretty long time.
Given a connected undirected graph with $$$n$$$ nodes and $$$m$$$ edges and the capacity of each edge is $$$1$$$. $$$maxFlow(u, v)$$$ defines the maximum flow from node $$$u$$$ to node $$$v$$$. You have to find out how many pair of nodes $$$(u, v)$$$ are there where $$$u < v$$$ and $$$maxFlow(u, v) = 2$$$ .You can assume that the graph won’t have any self loop.
$$$Constraints: 1<=n<=10^5, n-1<=m<=7*10^5$$$
You can find the problem here. It will be really helpful if you can provide me with a solution.
The following problem popped into my mind all of a sudden and I have no idea how to solve it.
You are given a weighted rooted tree with $$$n$$$ nodes. You need to find the number of unordered pairs of nodes $$$(u,v)$$$ such that
$$$Constraints: 1<=n<= 10^5, -10^6<=edge\,weights<=10^6$$$
It will be really helpful if you can provide me with a solution.
Well, one can count the number of primes less than or equal to n in (correct me if I am wrong) using Prime-counting function. You can solve this beautiful problem using the idea.
But recently I have come across following two (this and this) SPOJ problems with tag and have no idea how to solve them.
So If anyone can give me any idea about how to solve them, anyone will be appreciated respectfully. Thanks.
I am stuck on this following problem:
Given a string of size n, for each i from 1 to n you need to find if the string can be split into i non-empty non-intersecting palindromes. Output YES/NO.
1<=n<=100000
aabaa
YES
NO
YES
YES
YES
aabaa(1 palindrome), aa|b|aa(3 palindromes), a|b|a|aa(4 palindromes), a|b|a|a|a(5 palindromes)
Notice that you can not split the string into 2 palindromes.
Thanks for reading the problem. It will be really helpful if you can provide me with a solution.
I am stuck on this following problem:
Given an undirected connected simple graph of n nodes and m edges, for each node i from 1 to n you need to find if this node was not present in this graph how many connected components the graph would have.
1<=n,m<=100000
Input:
4 4 //4 nodes and 4 edges
1 2
2 3
2 4
3 4
Output:
1 2 1 1
A node is not present means erasing the node and its edges
Thanks for reading the problem. It will be really helpful if you can give me a solution.
I am stuck on this following problem:
Given a string of size n and q queries of type (l,r) you need to find how many palindromes are there in the substring of range [l...r].
1<=n,q<=100000
1<=l<=r<=n
Thanks for reading the problem. It will be really helpful if you can give me a solution.
I need to solve this following problem as a subproblem of another problem:
Statement:
You are given n sets S[1], S[2], S[3], ..., S[n] each having some distinct elements (Note that 2 different sets have common elements but each set have distinct elements).
Given q queries of type (i,j) you need to find if there is any common element in set S[i] and S[j]. Output YES/NO.
Constraints:
1<= n,size of S[i],elements of S[i],q <=100000
1<= sum of sizes of all sets <=100000
Thanks for reading the problem. It will be great if you can give me a solution.
I need to solve the following task as a subtask of another problem. So I need your HELP.
I need a Data Structure that can do the following operations:
Add a pair of integers (x,y) in the Data Structure.
For a given pair (a,b) it will give me the count of the number of pairs (x,y) such that x<=a and y<=b.
Note: Maximum Time Complexity for both of the operations can be at most O(log n).
Trivia: (not for this problem) I am interested if there is a solution with erase operation.
Name |
---|