**AND EVERYONE ELSE :D**

# | User | Rating |
---|---|---|

1 | tourist | 3707 |

2 | Benq | 3672 |

3 | ksun48 | 3575 |

4 | Radewoosh | 3562 |

5 | Miracle03 | 3480 |

6 | maroonrk | 3406 |

7 | ecnerwala | 3400 |

8 | peehs_moorhsum | 3384 |

9 | sunset | 3338 |

10 | Um_nik | 3320 |

# | User | Contrib. |
---|---|---|

1 | 1-gon | 208 |

2 | YouKn0wWho | 201 |

3 | Um_nik | 197 |

4 | Errichto | 181 |

4 | sus | 181 |

6 | awoo | 179 |

7 | tourist | 175 |

8 | -is-this-fft- | 171 |

8 | SecondThread | 171 |

10 | Ashishgup | 170 |

**AND EVERYONE ELSE :D**

I have a question. I have enabled "are test points allowed?" from the general description. Then I got a new column to specify test points individually. Please look at the picture bellow:

And the picture of Groups points policy:

Now, what to do? I have 20 test cases for group 1, 30 for group 2 and 50 for group 3. I want to give partial points to each of the individual groups. I want to give 20 points to group 1, 30 to group 2 and 50 to group 3. But how to do this? I can't find any option for this. And I set 1 point for each individual test cases. Will they be added up? I mean I have 20 cases for group 1 and each of them worths 1 point. Will they add up and make 20 points for that particular group?

**Edit:** This is my Checker code: Checker

Today I've listed some DP tutorials and problems. Actually, I made it for my personal practice. But I think It may Help others too.

Update: I write stuff Here in Bengali. I probably have one or two basic DP tutorials too. If you understand Bengali, it may help.

**Note: If you have some other tutorial links and nice problems, mention them. I'll add them here. It'll help me too.**

- Topcoder Tutorial
- Dynamic Programming,from novice to advanced
- Learn DP and other tricks
- Non-trivial DP tricks
- Everything about Dynamic Programming
- Digit DP 1
- some solutions of digit dp problems
- digit Dp for product digits
- Digit Dp tutorial bangla
- Digit DP hackerrank tutorial
- Important problems solutions of Digit DP
- DP on trees
- DP on trees problem-3
- DP on trees
- A Tricky DP Problem on Trees
- Bitmask DP
- SOS Dp
- Sum Over Subsets
- bitmask dp, buildup sos dp
- A little bit of classics: dynamic programming over subsets and paths in graphs
- Coin Problems
- nice DP problem Editorial
- Subsequence related Problem solution
- Smallest Word problem tutorial
- codechef Dp tutorials
- starting Dynamic Programming
- Introduction to DP-1 (hackerrank)
- A brief Introduction to DP
- Dp tutorials
- DP strategy
- Tutorial In Bangla

- DP tutorial #1 by Errichto
- DP tutorial #2 by Errichto
- DP tutorial #3 by Errichto
- Leetcode DP problems by Errichto
- Algorithms Series | Session 3 | Dynamic Programming (Arabic)
- Dynamic programming I (Arabic)
- DP playlist(Arabic)
- DP playlist2(Arabic)
- Atcoder DP contest solutions by Errichto
- DP playlist(English)
- DP playlist (created by gkcs, English)
- DP playlist2(English)
- DP playlist3(Englush)
- Dp playlist4(English)
- DP playlist5(English)
- DP playlist6(English)
- DP playlist7(English)
- DP MIT open course
- Atcoder DP contest stream
- vplanet DP tutorials
- Algorithms Live

You have to solve these problems to develop DP skills

- Lightoj Problems
- New Year and the Permutation Concatenation
- Multiply
- Stars Drawing(Easy Version)
- Consecutive Subsequence
- substring
- permute Digits
- Mike and GCD Problem
- Mahmud and message
- Travel Card
- Coloring Trees
- Robbers' Watch
- Alyona And the tree
- Geometric Progression
- Kyoya and balls
- soldier and number game
- Animals
- Flag
- Pavel and Triangles

- Appleman and Trees
- Counting On Trees
- Rivers
- Coffee shop
- mobiles
- Binary Apple Tree
- Tree pruning
- Anniveersary Problem
- Berland Fedaralization

- Complete Mirror
- Destroy it!
- Nauuo and Pictures (easy version)
- Ehab and the Expected GCD Problem
- And Reachability
- Card Bag
- Leaf Partition
- Sonya and Informatics
- Knapsack
- Power Tree

- Good DP Problems
- Bob and K — Subset
- Road
- A Race Against Time
- Nuske vs Phantom Thnook
- Xor Pyramid
- Rain and Umbrellas
- Equal

Thank You So Much.

Recently I tried to solve Loj-1339 and found some ideas.

**The main problem is :**

There are several **communities** in the city. Each community consists of some consecutive houses such that every house belongs to exactly one community. The houses are numbered from **1 to n**, and the communities are numbered from **1 to c**.

Now some inspectors want to find the strongest community considering all houses from **i to j**. A community is strongest if **maximum houses** in the range belong to this community. So, there can be more than one strongest community in the range. So, they want to know the number of houses that belong to the strongest community.

Each case starts with a line containing three integers **n (1 ≤ n ≤ 105), c (1 ≤ c ≤ n) and q (1 ≤ q ≤ 50000).** The next line contains n space separated integers (each between 1 and c) denoting the communities the houses belong to. You can assume that the input follows the restrictions given above, and there are exactly c communities.

Each of the next q lines contains two integers **i** and **j** **(1 ≤ i ≤ j ≤ n)** denoting that the inspectors are asking for the result considering houses from **i to j** (inclusive).

It can be done with Mo' algorithm. If I was told to find number of distinct integers from i to j then I can easily find the answer using Mo. but problems occur when max-min is wanted. I'm not able to keep track of the maximum community. When I add values, I can do this, but while removing,I can't find out a way to track the maximum. One of my friends told me to make a **sqrt decomposition** for the array. After adding/removing, somehow we have to maintain the **aux[]** array, and for queries, suppose we have sqrt(n) blocks, then from **i** to **j**, if any block is fully inside **i** and **j** then we just take the max from the block Id and if it doesn't , we just loop through the array. But I am not sure about this idea, also I can't implement it properly, can you please help me about this problem ? Thanks in advance.

Hello. I think codeforces contribution calculation system so complicated.I don't know how it is calculated. Can anyone tell me ? Is there any formulas or something else just like **rating change system** ? Sometimes I see that some of my comments has **+45** contribution, but my contribution increases only **4-5** and sometimes **+3/+4** changes the main contribution more than that. Suppose, I get downvote(let x) in a comment, but my main contribution changes randomly(I think so).

I didn't get any kinds of patterns. What's your opinion about it ? I wonder how it is calculated. If you know anything about it, please inform me, I'll be grateful to you. Thanks in advance.

`[Li..Ri]`

and then output the array .I updated them using **segment tree** and I found the array by querying indexes one by one. It took *nlog*(*n*). Can I do it in *O*(*n*) ? And additionally, can I find the condition of any index in O(1) ? Thanks in advance.

`Bitmask DP`

and used only a variable to see if some block was visited or not. But now I want to do it using `std::bitset`

. Will it be more or less efficient than the first one ? If yes or no, why ? I'm just confused. I think bitset should be fine. and I want to use it because it is easy to use.What's your opinion ? thanks in advance.

Hello, I have been trying a lot to solve Trail Maintence(LOJ), but I am getting RTE every time. I have been trying in many different ways, but at last I am getting RTE, don't know why. Can anyone help me debugging it please?

**Thanks in advance**

```
/**
*First of all, I will be taking input until the whole graph is connected, and also,
*For every query, I have to output -1.
*After getting the whole graph connected, I have to perform my first MST.
*then I will output the mst as well.
*then I have to input every remained query and for every steps, the last added edge
*will make e cycle, and we have to remove the largest edge form the graph, which is unnecessary.. then.. output the ans it :D
**/
#include <bits/stdc++.h>
using namespace std;
const int N = 503;
struct pii{
int a;
int b;
int c;
pii(){a = 0,b = 0,c = 0;}
pii(int m,int n,int o){
a = m;
b = n;
c = o;
}
};bool operator<(pii a,pii b){return a.c < b.c;}
int n,pos,size,ans,parent[N],q,u,v,w;
vector<pii>mst;
pii ara[N+12];
void makeset(){for(int i = 0; i < N;i++)parent[i] = i;}
int find(int n){return n==parent[n]?n:parent[n]=find(parent[n]);}
void Union(int a,int b){ parent[find(a)] = find(b);}
int first_mst()
{
sort(mst.begin(),mst.end());
makeset();
size = mst.size();
int sum = 0;
for(int i = 0; i < size;i++){
if(find(mst[i].a) != find(mst[i].b)){
Union(mst[i].a,mst[i].b);
ara[pos++] = pii(mst[i].a,mst[i].b,mst[i].c);
sum += mst[i].c;
}
}
return sum;
}
void mst2()
{
size = pos;
sort(ara,ara+size);
makeset();
int indx = -1;
int sum = 0;
for(int i = 0; i < size;i++){
if(find(ara[i].a) != find(ara[i].b)){
Union(ara[i].a,ara[i].b);
sum += ara[i].c;
}
else{
indx = i;
}
}
if(indx == pos-1){
pos--;
}
else if(indx != -1){
pii mm = ara[pos-1];
ara[indx] = mm;
pos--;
}
printf("%d\n",sum);
}
int main()
{
//freopen("in.txt","r",stdin);
int t,caseno = 0;
scanf("%d",&t);
while(t--){
mst.clear();
pos = 0;
makeset();
scanf("%d%d",&n,&q);
printf("Case %d:\n",++caseno);
int k = n;
while(q--){
scanf("%d%d%d",&u,&v,&w);
mst.push_back(pii(u,v,w));
if(find(u) != find(v)){
k--;
Union(u,v);
}
if(k == 1)break;
printf("-1\n");
}
int ans = first_mst();
printf("%d\n",ans);
while(q--){
scanf("%d%d%d",&u,&v,&w);
ara[pos++] = pii(u,v,w);
mst2();
}
}
return 0;
}
```

Hello, I have tried a lot to solve MKTHNUM-spoj. For solving this , I have slightly changed the problem statement, it goes like this :

**you are asked to find a number such that there are k-1 numbers less than that in range [l...r]**

Then I made a **merge sort tree** and sorted the initial array and **Binary Searched** it. My time complexity is : *O*((*log*2(*n*))^{2}) . I am getting **Runtime Error** in case 11 (i think). But couldn't find the bug :'( .

**Updt: Now I am getting wrong answer. first 14 test cases ran smmothly**

here goes my code :

```
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
const int N = 100099;
vector<int>tree[N*3];
int ara[N+12];
void build(int at ,int l,int r)
{
if(l == r){
tree[at].push_back(ara[l]);
return;
}
int mid = (l+r)/2;
build(at*2,l,mid);
build(at*2+1,mid+1,r);
merge(all(tree[at*2]),all(tree[at*2+1]),back_inserter(tree[at]));
}
int query(int at,int L,int R,int l,int r,int indx)
{
if(l > R or r < L)return 0;
if(L >= l and r >= R){
int pp = upper_bound(all(tree[at]),ara[indx])-tree[at].begin();
return pp;
}
int mid = (L+R)/2;
return query(at*2,L,mid,l,r,indx) + query(at*2+1,mid+1,R,l,r,indx);
}
int main()
{
int n,q,l,r,k;
scanf("%d%d",&n,&q);
for(int i= 1; i <= n;i++){
scanf("%d",&ara[i]);
}
build(1,1,n);
sort(ara+1,ara+1+n);
while(q--){
scanf("%d%d%d",&l,&r,&k);
int high = n,low = 1,mid,ans = -1;
int cnt = 0;
while(low <= high){
mid = (low+high)/2;
int pp = query(1,1,n,l,r,mid);
if(k <= pp){
ans = mid;
high = mid-1;
}
else low = mid+1;
}
printf("%d\n",ans);
}
return 0;
}
```

**Now I want to solve some problems and learn advanced algos related to it. please help me by giving me more sources.**

I saw someone to use a function instead of cin/scanf to input a number;

like that :

```
int n;
n = in();
```

where in() function is given bellow :

```
template <typename T> T in(){char ch;T n = 0;bool ng = false;while (1){ch =getchar();if (ch == '-'){ng = true;ch = getchar();break;}if (ch>='0' && ch<='9')break;}while (1){n = n*10 + (ch - '0');ch = getchar();if (ch<'0' || ch>'9')break;}return (ng?-n:n);} ?
```

i don't know what is faster , i also don't know , how scanf or cin works , can anyone please tell me ????

Hello codeforces , hello everybody , you all know , ACM ICPC is gonna be started , :) , and many of the participants are also CF users , and let's start a game for them , according to codeforces ratings , can you tell me which team is first ???

All you have to do , calculate their average ratings , and add them ( add the three ratings ) and divide them by 3 , Because there are 3 members in a team , and finally you will get a average rating , and according to them , you have to find the maximum rating of all the teams , and comment the name of their country and team/University name . and if you get board , you should not do it , you will suggest the avg ratings of a team in the comment box and i will fix it .

the winner will be included soon i wish :D :D

happy coding everybody :D :D good luck 1.

Hello everybody , I have tried a lot to solve the light oj 1087 — Diablo problem .

problem link : http://www.lightoj.com/volume_showproblem.php?problem=1087

My test sample output is not matching , I have tried a lot , I am a noob , please help me to debug my code . Why does it occur ??

my code : https://paste.ubuntu.com/26080511/

Please help me , Downvote ?? It's okay . But please help me ..................

Hello , I can't realize why the judge output is much strange !!! problem link : http://codeforces.com/contest/451/problem/B

my code : https://paste.ubuntu.com/25939858/

judge status : http://codeforces.com/contest/451/submission/32225322

in my compiler , answer is okay , but where is the problem ?? I have also tested in different online compilers also

I have tried a lot to solve the "milking cow" problem of USACO . But WA in test 7 . I don't know what is the problem , i have tried multiple approaches , but it still wrong in test 7 . can you please help me to find my bug please ????

my code : https://paste.ubuntu.com/25901070/

problem source : http://train.usaco.org/usacoprob2?a=pxSIvVnwAXn&S=milk2

please please please help me guys , I have tried my best .

Just one question , am I doing any kinds of segmentation violation ?? such as -> wrong ara indexing or accessing memory out of bounds etc etc ???

memory limit : 256 mb

Hello everybody , please help me , i was solving problems in light oj , "curious Robin Hood" and getting wrong answer. problem link : http://lightoj.com/volume_showproblem.php?problem=1112

code link : https://paste.ubuntu.com/25753376/

i am a beginner and i recently learned a bit about segment tree , i used segment tree in this solution , but i can't find my faults , can anyone please help me ?

everything seems okay , where is the problem ? can you explain ? problem link : http://codeforces.com/contest/855/problem/B

my code : https://paste.ubuntu.com/25608466/

Hello everybody , how are you ? Today I am going to describe some contents (programming) Which can be helpful for contestants.

At first I assume that you all know about C/C++ language . But It doesn't matter . I think you also know about conditional logic , loop , datatype(input/output) , strings, array, function , basic bitwise operation etc . I think then you should learn lots of Mathematical terms such as :

Prime number , GCD , LCM , Eular's Totirnt Function , Bigmod , Modular inverse , Extended GCD , combinatorics, permutation , combination , inclusion exclusion principle ,probability , Expected value , Base conversation , Big integer , cycle , Gawssian elimination etc etc........

**Then.....**

you have to learn about sorting and searching . like : Insertion sort , bubble sort , merge sort , selection sort , merge sort , county sort etc . NOTE : THERE IS A THING NAMED "qsort" function is C language.....don't use it . There is an algorithm named "anti-qsort" . If you use it in codeforces , anyone can easily hack your solution because anti-qsort algorithm generates worst case for qsort and in the worst case , it's time complexity will be O(n^2) . But you can use Standerd Template Library .

**Then........**

You have to learn Binary search , Backtraking , ternary search etc...

**Then.......**

you have a task to learn lots of data structures . Such as : Linked list , Stack,Queue,heap , vector,graph,tree,segment tree , binary search tree , sqare root segmentation , disjoint set union , Lazy with proposition , lazy without proposition , Binary indexed tree , map , set , pair etc etc....

**Then........**

You haVe to learn greedy technique , Dyanamic programming , Graph algorithm , Flow , Adhoc , Geometry etc etc , I have summarized the contents bellow : 1. Dynamic Programming 2. Greedy 3 .Complete Search 4 . Flood Fill 5 . Shortest Path 6 . Recursive Search Techniques 7 . Minimum Spanning Tree 8 . Knapsack 9 . Computational Geometry 10 .Network Flow 11 . Eulerian Path 12 . Two-Dimensional Convex Hull 13 . BigNums 14 . Heuristic Search 15 . Approximate Search 16 . Ad Hoc Problems

If you clearup all those above , you will find a great programmer inside you , but mind it , It is not an easy tusk....You have to practice a lot . If you don't practice , you will never be able to be a good programmer .....!!!

SO , NO MORE TODAY ,,,, STAY WELL EVERYBODY,,,,ALWAYS TRY TO HELP OTHERS...HAPPY CODING !

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/27/2021 20:32:45 (k1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|