原创 luogu-P1503(fhq treap)

題目背景 小卡正在新家的客廳中看電視。電視里正在播放放了千八百次依舊重播的《亮劍》,劇中李雲龍帶領的獨立團在一個縣城遇到了一個鬼子小隊,於是獨立團與鬼子展開游擊戰。 題目描述 描述 縣城裏有n個用地道相連的房子,第i個只與第i-1

原创 luogu-p1603

題目描述 在MarsMars星球上,每個MarsMars人都隨身佩帶着一串能量項鍊。在項鍊上有NN顆能量珠。能量珠是一顆有頭標記與尾標記的珠子,這些標記對應着某個正整數。並且,對於相鄰的兩顆珠子,前一顆珠子的尾標記一定等於後一顆珠

原创 Gym - 102439H(數位DP)

Fibonacci numbers — well-known integer sequence, where F0=0, F1=1 and Fn=Fn−1+Fn−2 for n>1. Lesha doesn’t like this

原创 HDU-1074(狀壓DP)

Problem Description Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do.

原创 Codeforces-356A(STL運用)

Hooray! Berl II, the king of Berland is making a knight tournament. The king has already sent the message to all kn

原创 luogu-p1880

題目描述 在一個圓形操場的四周擺放 NN 堆石子,現要將石子有次序地合併成一堆.規定每次只能選相鄰的2堆合併成新的一堆,並將新的一堆的石子數,記爲該次合併的得分。 試設計出一個算法,計算出將 NN 堆石子合併成 11 堆的最小得分

原创 HDU-5945(DP+單調隊列優化)

Problem Description Young theoretical computer scientist Fxx designed a game for his students. In each game, you wi

原创 LightOJ - 1077(GCD)

Given two points A and B on the X-Y plane, output the number of the lattice points on the segment AB. Note that A a

原创 CodeForces 343D(樹鏈剖分+線段樹)

Mad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which ca

原创 HDU-1828(掃描線+線段樹)

Problem Description A number of rectangular posters, photographs and other pictures of the same shape are pasted on

原创 UVA - 11297(線段樹套線段樹)

放個鏈接在這裏:UVA - 11297 This year, there have been many problems with population calculations, since in some cities, th

原创 Spoj 10628 (樹上主席樹+LCA)

You are given a tree with N nodes. The tree nodes are numbered from 1 to N. Each node has an integer weight. We wil

原创 CodeForces - 707D (離線+DFS模擬)

Recently in school Alina has learned what are the persistent data structures: they are data structures that always

原创 Codefroces-510D

Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, n

原创 ICPC Latin American Regional – 2017 B題(模擬+思維)

ICPC Latin American Regional – 2017 Alan Curing is a famous sports programmer. He is the creator of the theoretical