0w1

Entries from 2016-02-05 to 1 day

Randomized binary search tree on value

I have never wrote one to split by value, but for segments. Here's a simple problem that gave me my first chance to solve one like that. http://zerojudge.tw/ShowProblem?problemid=d794 World Ranking The input will give you scores, and you h…

Strong connected components

When a directed graph set S satisfies "for every vertex u and v, exists a path from u to v", this graph could be called an SCC. SCC can be found by applying DFS twice. This is called Kosaraju's algorithm O( V + E ). DFS1 will start from an…

Little interesting logic problem

Problem statement: 100 people are on the same field, and each of them wears a hat with a color ( only 2 kinds of colors ). Each of them can see all the distribution of the colors except his/her own. Now each person has to guess the color o…

Codeforces Contest 624

Dashboard - AIM Tech Round (Div. 2) - Codeforces pA. Print ( L - d ) / ( v1 + v2 ). #include <bits/stdc++.h> using namespace std; int main(){ int d, L, v1, v2; scanf("%d %d %d %d", &d, &L, &v1, &v2); double dis = (double)L - d; double vel = (double)v1 + </bits/stdc++.h>…

Range Mex

Mex ( minimum excludant ), has an interesting property in game theory, where an sprague grundy value of a state in a fair game can be deduced from the mex of the sg-values of all the states it could reach in the next step.The definition of…