原创 Petya and Array CodeForces - 1042D 線段樹+思維

Petya has an array aa consisting of nn integers. He has learned partial sums recently, and now he can calculate the sum

原创 2019牛客暑期多校訓練營(第九場) H Cutting Bamboos 主席樹+二分

鏈接:https://ac.nowcoder.com/acm/contest/889/H 來源:牛客網   時間限制:C/C++ 5秒,其他語言10秒 空間限制:C/C++ 262144K,其他語言524288K Special Judg

原创 Game 2019 年百度之星·程序設計大賽 - 初賽一 思維

Game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 547    Ac

原创 2019牛客暑期多校訓練營(第九場) E All men are brothers 並查集+數學

鏈接:https://ac.nowcoder.com/acm/contest/889/E?&headNav=acm&headNav=acm 來源:牛客網   題目描述 Amy asks Mr. B  problem E. Please h

原创 Snowy Smile HDU - 6638 利用線段樹區間合併 求最大字段和

Snowy Smile Time Limit: 4000/4000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s):

原创 K-th Closest Distance HDU - 6621 主席樹+二分

K-th Closest Distance Time Limit: 20000/15000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Sub

原创 GCD HDU - 5726 線段樹+數學

Give you a sequence of N(N≤100,000)N(N≤100,000) integers : a1,...,an(0<ai≤1000,000,000)a1,...,an(0<ai≤1000,000,000). Th

原创 Different GCD Subarray Query HDU - 5869 線段樹+離線處理

This is a simple problem. The teacher gives Bob a list of problems about GCD (Greatest Common Divisor). After studying

原创 GCD HDU - 5930

Mr. Frog likes generating numbers! He can generate many numbers from a sequence.  For a given sequence a1,a2,⋯,ana1,a2,

原创 牛客競賽 整數序列 線段樹+數學

鏈接:https://ac.nowcoder.com/acm/contest/160/D?&headNav=www 來源:牛客網   題目描述 給出一個長度爲n的整數序列a1,a2,...,an,進行m次操作,操作分爲兩類。 操作1:給出

原创 HDU 3333 Turing Tree 主席樹/線段樹離線處理

After inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could

原创 2019牛客暑期多校訓練營(第七場) 權值線段樹或主席樹

鏈接:https://ac.nowcoder.com/acm/contest/887/C 題目描述 The Wow village is often hit by wind and sand,the sandstorm seriously

原创 Tunnel Warfare HDU - 1540 線段樹區間合併

During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China

原创 D-query SPOJ - DQUERY 主席樹/線段樹離線處理

Given a sequence of n numbers a1, a2, ..., an and a number of d-queries. A d-query is a pair (i, j) (1 ≤ i ≤ j ≤ n). Fo

原创 Sasha and Array CodeForces - 719E 線段樹維護矩陣+矩陣快速冪

Sasha has an array of integers a1, a2, ..., an. You have to perform m queries. There might be queries of two types: 1 l