原创 hdu 5222 Exploration

Exploration Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submissi

原创 poj 3666 Making the Grade (動態規劃)

Making the Grade Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4647   Accepted: 2202 Description A

原创 C. Vanya and Scales (進制轉換)

C. Vanya and Scales time limit per test 1 second memory limit per test 256 megabytes input standard input out

原创 主席樹簡單入門

主席樹在每次更新的葉子節點時,記錄從根節點開始一路到葉子節點的更改節點信息。每個節點值更新後,還可以通過該節點更新前的根節點查詢之前的信息。 如下圖所示: 入門題目:給定n個數,q個詢問,每次回答某個區間內不相同的元素個數。n, q(1

原创 nowcoder 失衡天平

失衡天平 時間限制:C/C++ 1秒,其他語言2秒 空間限制:C/C++ 262144K,其他語言524288K 64bit IO Format: %lld 題目描述 終於Alice走出了大魔王的陷阱,可是現在傻傻的她忘了帶武器了,這可如

原创 重建二叉樹(根據前序遍歷和中序遍歷構建二叉樹)

題目描述 輸入某二叉樹的前序遍歷和中序遍歷的結果,請重建出該二叉樹。假設輸入的前序遍歷和中序遍歷的結果中都不含重複的數字。例如輸入前序遍歷序列{1,2,4,7,3,5,6,8}和中序遍歷序列{4,7,2,1,5,3,8,6},則重建二叉樹

原创 字典樹 (網易互娛2018筆試題目第4題)

網易互娛筆試第4題,給定一些手機號以及對應的歸屬地,查詢手機號的歸屬地。 2 3 1357xxxxxxx GuangZhou01 13680xxxxxx GuangZhou01 13799xxxxxx HangZhou02 3 13579

原创 01揹包記錄所裝物品

D. Tanks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa

原创 二叉樹的非遞歸遍歷 (leetcode 104.二叉樹的最大深度)

二叉樹前序遍歷:先訪問根結點,然後右子樹入棧,最後左子樹入棧; #define mp make_pair class Solution { public: int maxDepth(TreeNode* root){

原创 hdu 2476 (區間動態規劃)

String painterTime Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5

原创 字符串最小表示法(LeetCode 899. Orderly Queue )

A string S of lowercase letters is given.  Then, we may make any number of moves. In each move, we choose one of the fi

原创 E. Maximum Subsequence (meet-in-the-middle)

E. Maximum Subsequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard ou

原创 AtCoder Grand Contest 018--D題

D - Tree and Hamilton Path Time limit : 2sec / Memory limit : 256MB Score : 1100 points Problem Statement There

原创 Codeforces Round #424 (Div. 1, rated, based on VK Cup Finals)

C. Bamboo Partition time limit per test 2 seconds memory limit per test 512 megabytes input standard input ou

原创 G. Xor-MST (分治+Trie樹)

G. Xor-MSTtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are