Given n 2d points
(x,y) , x<=1e5 , y<=1e5
n<=1e5
find the number of triplet such that all x's are different and all y's are different
ex: valid triplet is (1 , 3) , (2 , 2) , (3 , 1)
pLease share some ideas how to solve it
Thanks in advance
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
Given n 2d points
(x,y) , x<=1e5 , y<=1e5
n<=1e5
find the number of triplet such that all x's are different and all y's are different
ex: valid triplet is (1 , 3) , (2 , 2) , (3 , 1)
pLease share some ideas how to solve it
Thanks in advance
Problem Description
You love strings a lot, so you decided to play the following game.
You have a tree T of A nodes. The tree is represented by a matrix B of dimensions (A — 1) * 2 such that there exist an edge between node B[i]|1| and B[i][2]
Each node is assigned a lowercase english character, which is represented by a string C of length A. Node is assigned character at position i of string C. You are given Q queries in the form of a matrix D of dimensions Q * 2 For each you query you will perform the following steps:
You will move from node p[i][1] to node D[i][2] using the shortest possible path.
Let V[1], V[2]...V[K] be the nodes visited in the corresponding order. Create a string $ such that length of S is equal to K and S[i]=c[v|i]]
Store string S in your bag.
Return the number of unique strings you would create.
Problem Constraints
I <= A <= 10 ^ 5
B is a matrix of dimensions (A — 1) * 2
Feel free to share aprroaches Thanks in Advance
1<=B[i][1] , B[i][2] <= A
length(C) = A
Conly contains lowercase english alphabets
1 <= Q <= 10 ^ 5
D is a matrix of dimensions Q * 2
1<=D[i][1],D[i][2]<=A
Given the m ranges that denotes subarray of an array of length n i --> [l ,r] 1<=l<=r<=n Cost of Concatination of two ranges is 1 Find the min cost to overlap the whole array or return -1 if not exist
1<=n<=100
Plz help. Thanks in advance
We are given an array of size n and we have to determine if it is possible to arrange the elements in such a way that the absolute difference between two adjacent elements is 1.The first and the last element are also considered adjacent. for example, for array A=[1,2,3,2] the answer is YES. Thanks in advance.
You are given an array A of size N. A special number of a subsequence S is a number formed by the concatenation of all the elements of the subsequence S.
Find the count of non-empty subsequences of A having their special number divisible by X and of length K. Since the answer can be huge, output it modulo 10^9+7
I dont know How to start this Plzz help??
Constraint:- 1 <= T <= 10 1 <= N <= 10^3 2 <= X <= 20 1 <= A[i] < 1000 1 <= K <= 100
static bool comp(string a ,string b){ return a.size()<=b.size(); }
I used this in leetcode But this gives Error "terminate called after throwing an instance of 'std::length_error' "
after changing it to --> a.size()<b.size() this works How this works????
Name |
---|