# CodeForces 614E - Necklace 题解：构造

## Description

Ivan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic sequence of beads of different colors. Ivan says that necklace is beautiful relative to the cut point between two adjacent beads, if the chain of beads remaining after this cut is a palindrome (reads the same forward and backward).

More...

# CodeForces 295E - Yaroslav and Points 题解：又是线段树！

## Description

Yaroslav has n points that lie on the $Ox$ axis. The coordinate of the first point is $x_1$, the coordinate of the second point is $x_2$, ..., the coordinate of the n-th point is — $x_n$. Now Yaroslav wants to execute $m$ queries, each of them is of one of the two following types:

More...

# CodeForces 447E - DZY Loves Fibonacci Numbers 题解：线段树

## Description

In mathematical terms, the sequence $F_n$ of Fibonacci numbers is defined by the recurrence relation

$$F_1 = 1; F_2 = 1; F_n = F_{n - 1} + F_{n - 2} (n > 2)$$

DZY loves Fibonacci numbers very much. Today DZY gives you an array consisting of n integers: $a_1, a_2, \dots, a_n$. Moreover, there are $m$ queries, each query has one of the two types:

More...

# 矩阵乘法在图论中的简单应用

$$C[i,j]=\sum_{k=1}^{b} A[i,k]\ast B[k,j]$$

More...

# C++ 手写 Bitset 代码模板

## 引言

Bitset 是一种利用对布尔数组压位存储的方法，达到优化时间常数、空间常数的目的的黑科技。利用 Bitset，可以方便地对布尔数组进行按位逻辑运算，优化 32 或 64 的常数。在某些素质极差的卡常题中运用会有奇效。

More...

More...

# （转）八大排序算法稳定性分析

1. 堆排序、快速排序、希尔排序、直接选择排序不是稳定的排序算法；
2. 基数排序、冒泡排序、直接插入排序、折半插入排序、归并排序是稳定的排序算法。

More...

# 分享几道 NOIP 初赛的奇葩题目

• 孙某说：如果我不知道的话，张某肯定也不知道。
• 张某说：刚才我不知道，听孙某一说，我现在知道了。
• 孙某说：哦，那我也知道了。

More...

# LightOJ 1073 DNA Sequence 题解：字符串+状压 DP+字符串压位/搜索

## Description

You are given a list of strings over the alphabet A (for adenine), C (cytosine), G (guanine), and T (thymine), and your task is to find the shortest string (which is typically not listed) that contains all given strings as substrings. If there are several such strings of shortest length, find the smallest in alphabetical/lexicographical order.

Time Limit: 4 second(s)
Memory Limit: 32 MB

More...