Recruiting 题目描述Hurry! Two well-known software companies are recruiting programmers. Initially the total number of unemployed programmers is $n$. The companies are hiring them one by one, alternately. In one turn 2018-05-15 OI > Graph Theory #Shortest Path
Divisibility 题目描述Inspired by Stephen Graham, the King of Berland started to study algorithms on strings. He was working days and nights, having a feeling that the full potential in this area is still to be unlocke 2018-05-05 OI > Number Theory #GCD-LCM
Traffic Lights 题目描述The main street of Berland’s capital is a segment with length $s$. The main street has traffic lights installed along it. The traffic lights have been functioning since time immemorial, cyclically 2018-05-02 OI > Common Skill #Implementation #Discretization
Chess Championship 题目描述Chess Championship is set up in the New Basyuki City. Two national teams, of Berland and Byteland, are going to have a match there. Each team is represented by $n$ players. The championship consis 2018-04-30 OI > Common Skill #Dynamic Programming
Gena vs Petya 题目描述Gena and Petya love playing the following game with each other. There are $n$ piles of stones, the $i$-th pile contains $a_i$ stones. The players move in turns, Gena moves first. A player moves by 2018-04-30 OI > Number Theory #Dynamic Programming #Game Theory
Kyoya and Train 题目描述Kyoya Ootori wants to take the train to get to school. There are $n$ train stations and $m$ one-way train lines going between various stations. Kyoya is currently at train station $1$, and the sch 2018-03-17 OI > Number Theory #Dynamic Programming #Fast Fourier Transform #Divide-and-Conquer
Optimized Input and Output in C++ BackgroundC++标准库<iostream>中的cin, cout相比<cstdio>中的scanf, printf要方便许多,但速度也较为缓慢。在输入输出的数据类型不是很特殊时,可以使用以下代码来代替cin, cout(要包含<cctype>, <cstdio>,不要包含<iostream>)。 Code123456789101 2018-03-14 Coding > Programming Language #C/C++
Introduction to KMP Background在字符串理论中,经常要求一个字符串$T$在另一个字符串$S$中所有出现的位置。这个过程就是字符串匹配。我们称$S$为文本,$T$为模式。下面介绍一种时间复杂度为线性的算法 KMP,可以解决此类问题。 Introduction令$S_i$表示字符串$S$的第$i$个字符,$S_{i, j}$表示字符串$S$的第$i$到第$j$个字符构成的字符串。为了方便讲解,字符串下标从$1$开 2018-03-14 OI > String #Knuth-Morris-Pratt Algorithm #Note
Picnic Cows 题目描述It’s summer vocation now. After tedious milking, cows are tired and wish to take a holiday. So Farmer Carolina considers having a picnic beside the river. But there is a problem, not all the cows 2018-03-12 OI > Common Skill #Dynamic Programming #Greedy #Monotonic Queue
Print Article 题目描述Zero has an old printer that doesn’t work well sometimes. As it is antique, he still like to use it to print articles. But it is too old to work for a long time and it will certainly wear and tear 2018-03-10 OI > Common Skill #Dynamic Programming #Monotonic Queue