SPOJ:To the moon】的更多相关文章

题面 vjudge Sol 主席树模板 # include <bits/stdc++.h> # define RG register # define IL inline # define Fill(a, b) memset(a, b, sizeof(a)) using namespace std; typedef long long ll; const int _(1e5 + 5); const int __(5e6); IL int Input(){ RG int x = 0, z = 1…
spoj传送门 vjudge传送门 主席树板子题. 支持历史版本的区间和,区间和,区间修改和时光倒流. 其中新奇一点的也只有区间修改了,这个东西直接标记永久化就行了. 如果想下传标记的话也行,需要在pushdown的时候新建一波节点. 代码: #include<cstdio> #include<cctype> #define ll long long #define N 100005 using namespace std; inline ll read(){ ll ans=0,w…
To the moon Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 8372    Accepted Submission(s): 1986 Problem Description BackgroundTo The Moon is a independent game released in November 2011, it is…
After the success of 2nd anniversary (take a look at problem FTOUR for more details), this 3rd year, Travel Agent SPOJ goes on with another discount tour. The tour will be held on ICPC island, a miraculous one on the Pacific Ocean. We list N places (…
http://www.spoj.com/problems/NPC2016A/en/ 题意:在一个n*n的平面里面,初始在(x,y)需要碰到每条边一次,然后返回(x,y),问最短路径是多长. 思路:像样例中给出的,假设一开始是在(x,y),那么走一个斜率为1和-1的路径,因为两边对称,所以ans = 2 * x * sin(45°) + 2 * (n - x) * sin(45°) = 2 * n * sqrt(2). 就是每次走的都是对角线的长度. #include <bits/stdc++.h…
Vjudge题面 Time limit 2000 ms Memory limit 65536 kB OS Windows Source 2012 Multi-University Training Contest 5 SPOJ原版题面 Background To The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker. Th…
浅谈主席树:https://www.cnblogs.com/AKMer/p/9956734.html 浅谈标记永久化:https://www.cnblogs.com/AKMer/p/10137227.html 题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=4348 相比一般的主席树,这个要多支持一个操作,那就是区间修改.我们不能把区间里的每一条链都建出来,因为那样时间空间都不允许,所以我们可以依靠标记永久化来实现.每次询问的时候,把一路上的标记全…
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). For each d-query (i, j), you have to return the number of distinct elements in the subsequence ai, ai+1, ..., aj. Input Line 1: n (1…
"Holiday is coming, holiday is coming, hurray hurray!" shouts Joke in the last day of his college. On this holiday, Joke plans to go to his grandmother's house located in Schematics village. Joke's grandmother's house is more than a hundred year…
Taplu and Abhishar loved playing scrabble. One day they thought of inventing a new game using alphabet tiles. Abhishar wrote a string using tiles and gave a set of pairs (i,j) to Taplu. Pair “i, j” (0 based indexing) means that Taplu can swap the i’t…