原创 牛客網暑期ACM多校訓練營(第三場) H Diff-prime Pairs

題目鏈接   Eddy has solved lots of problem involving calculating the number of coprime pairs within some range. This proble

原创 The 2018 ACM-ICPC China JiangSu Provincial Programming Contest J. Set

Let's consider some math problems. JSZKC has a set A={1,2,...,N}. He defines a subset of A as 'Meo set' if there doesn'

原创 Codeforces 1006B Polycarp's Practice

Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a1,a2,…,an, respectivel

原创 The 2018 ACM-ICPC China JiangSu Provincial Programming Contest K Road

JSZKC is the king of his kingdom. His kingdom has NN cities, numbered from 0 to N-1. And the cities are connected by so

原创 hihoCoder 狀態壓縮二 狀態壓縮dp 入門題 4

描述 歷經千辛萬苦,小Hi和小Ho終於到達了舉辦美食節的城市!雖然人山人海,但小Hi和小Ho仍然抑制不住興奮之情,他們放下行李便投入到了美食節的活動當中。美食節的各個攤位上各自有着非常多的有意思的小遊戲,其中一個便是這樣子的: 小Hi和小

原创 Codeforces 1064D Labyrinth(雙向隊列,BFS)

You are playing some computer game. One of its levels puts you in a maze consisting of n lines, each of which contains

原创 BZOJ 4260 Codechef REBXOR

1.題鏈接   求兩個不相交的區間各自異或後相加的最大值。n的範圍1<=n<=4e5   首先我們知道 前 i 個數的異或和前 j 個數的異或相異或: pre[i]^pre[j] = a[i+1]^a[i+2]^……^a[j],(i<j)

原创 BZOJ3631 [JLOI2014]松鼠的新家

Description 松鼠的新家是一棵樹,前幾天剛剛裝修了新家,新家有n個房間,並且有n-1根樹枝連接,每個房間都可以相互到達,且倆個房間之間的路線都是唯一的。天哪,他居然真的住在“樹”上。松鼠想邀請小熊維尼前來參觀,並且還指定一份參觀

原创 Codeforces 1051D Bicolorings

You are given a grid, consisting of 2 rows and n columns. Each cell of this grid should be colored either black or whit

原创 Codeforces 1042 C Array Product

You are given an array a consisting of n integers. You can perform the following operations with it: Choose some positi

原创 Codeforces 245H Queries for Number of Palindromes (區間DP)

You've got a string s = s1s2... s|s| of length |s|, consisting of lowercase English letters. There also are q queries,

原创 Codeforces 1037D Valid BFS? (BFS)

The BFS algorithm is defined as follows. Consider an undirected graph with vertices numbered from 1 to n. Initialize q

原创 HDU 5692 Snacks

Problem Description 百度科技園內有n個零食機,零食機之間通過n−1條路相互連通。 每個零食機都有一個值v,表示爲小度熊提供零食的價值。 由於零食被頻繁的消耗和補充,零食機的價值v會時常發生變化。小度熊只能從編號爲0的零

原创 Wannafly挑戰賽22 D 整數序列

題目描述 給出一個長度爲n的整數序列a1,a2,...,an,進行m次操作,操作分爲兩類。 操作1:給出l,r,v,將al,al+1,...,ar分別加上v; 操作2:給出l,r,詢問 輸入描述: 第一行一個整數n 接下來一行n個整數表

原创 分塊入門1~9 (完結撒花)

LOJ 終於肝完了分塊的九種基礎類型,調bug調得是真(超)是(級)開(惡)心。 有腦殘的時候,把塊的編號當成元素的下表。數組開太小會莫名超時。 建議讀者刷LOJ上的分塊入門1~9 loj#6277. 數列分塊入門 1 區間加法,單點查詢