Ural
文章平均质量分 72
utoppia
这个作者很懒,什么都没留下…
展开
-
Ural 1210
最短路神马的最有意思。。。/************************************************************************* > File Name: 1210.cpp > Author: utoppia > Mail: utoppia@163.com > Created Time: 2013/12/20 9:原创 2013-12-20 09:32:27 · 747 阅读 · 0 评论 -
Ural 1087. The Time to Take Stones
Ural 1087我们需要知道一些博弈论的小知识。我们用win[i]来表示i的状态;win[i]=1表示比胜态win[i]=0表示必败态那么win[i] = 0 当且仅当 其所有的子状态 win[j] = 1; win[i] = 1 当且仅当 至少有一个子状态 win[j]=0;我们用类似dp的方法求出win[n]就解决了这个问题。原创 2013-08-07 10:45:56 · 736 阅读 · 0 评论 -
Ural 1023. Buttons
Ural 1023我们知道n个石子,每次取1-L个那么n是必败态就是 n%(L+1)==0;于是员问题就等价于求n的大于3的约数,然后将这个数减一就是答案。CODE:#include#include#include#include#include#include#include#include#include#includeusing namespa原创 2013-08-07 00:35:48 · 813 阅读 · 0 评论 -
Ural 1180 Stone Game
Ural 1180超级入门级别的组合游戏。Alice赢的可能就是这个数不是3的倍数,否则就是必败态。当然,一切都是从最简单的开始。开始Game时代。。。CODE:#include#include#include#include#include#include#include#include#include#includeusing namespa原创 2013-08-07 00:21:07 · 638 阅读 · 0 评论 -
URal 1350. Canteen
PRO IS HERE大家可以看看翻译题意神马的就理解了:Translate集合的判断,是否相交什么的。大水题。。。纯暴力就足够了。。。CODE:#include#include#include#include#include#include#include#include#include#includeusing names原创 2013-06-06 11:49:30 · 799 阅读 · 0 评论 -
Ural 1521. War Games 2
PRO IS HERE简单的数状数组 + 二分搜索。CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b)原创 2013-06-05 22:32:49 · 1043 阅读 · 0 评论 -
Ural 1090. In the Army Now
PRO IS HERE逆序对。CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)#define原创 2013-06-04 16:51:11 · 645 阅读 · 0 评论 -
Ural 1471. Tree
PRO IS HERE离线最近公共祖先;LCA;d[u,v] = d[root,u]+d[root,v] - 2*d[root,ancestor(u,v)];CODE:#include#include#include#include#include#include#include#include#include#includeusin原创 2013-06-04 16:22:34 · 608 阅读 · 0 评论 -
Ural 1494. Monobilliards
PRO IS HEREA Easy Problem about Stack;CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=原创 2013-06-04 15:22:56 · 1114 阅读 · 0 评论 -
Ural 1306. Sequence Median
PRO IS HERE优先队列;维护一个大小为N/2的最大堆。实现的话用STL 的 priority_queueCODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#defi原创 2013-05-30 15:07:27 · 685 阅读 · 0 评论 -
Ural 1671. Anansi's Cobweb
PRO IS HEREUnion_Find set:并查集。注意我们从后往前加边,离线算法。如果有某条边删除两次以上,只保留较早的那个删除操作,实现时用vis判断。CODE:#include#include#include#include#include#include#include#include#include#includeus原创 2013-05-30 15:50:45 · 728 阅读 · 0 评论 -
Ural 1613. For Fans of Statistics
PRO IS HEREMap + lower_bound轻松解决;CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a)原创 2013-05-30 15:32:58 · 630 阅读 · 0 评论 -
Ural 1060. Flip Game
Ural 1060状态压缩,然后bfs最短路。轻松解决CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)+原创 2013-08-07 12:51:57 · 707 阅读 · 0 评论 -
Ural 1195 Ouths and Crosses
Ural 1195题目大意就是给定一个3X3的格子问其状态是否是必胜态。因为数据量小的可怜,我们直接暴力搜索就可以搞定。CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define F原创 2013-08-07 12:16:05 · 898 阅读 · 0 评论 -
Ural 1465 Pawn Game
Ural 1465Nim游戏变形,sg算子的应用吧。我们知道这样的棋盘分布唯一的转移状态只有三种形式,然后暴力求出sg值就行。但是题目的数据量太大,我们大表发现其实这里边室友循环的,于是就可以解决这些问题了。CODE:#include#include#include#include#include#include#include#include#incl原创 2013-08-08 01:04:45 · 931 阅读 · 0 评论 -
Ural 1354
做个字符串哈希玩玩。。。/************************************************************************* > File Name: 1354.cpp > Author: utoppia > Mail: utoppia@163.com > Created Time: 2013/12/19 9:4原创 2013-12-19 10:57:43 · 703 阅读 · 0 评论 -
Ural 1437
I HATE THIS PROBLEM!!! I just write a BF solution like this:#include#include#include#include#include#include#includeusing namespace std;#define sf scanf#define pf printf#define re原创 2013-11-27 13:42:15 · 649 阅读 · 0 评论 -
Ural 1371. Cargo Agency
The author is lazy..Code :#include#include#include#include#include#includeusing namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#def原创 2013-11-27 11:49:13 · 725 阅读 · 0 评论 -
Ural 1362 Classmates 2
Link To The Pro其实就是简单的树形dp;假设v1,v2,v3..vs是u的儿子,那么将dp[vi]从大到小排序;dp[u] = max(dp[v_i] + i];Code:#include#include#include#include#include#includeusing namespace std;#define原创 2013-11-27 09:58:00 · 963 阅读 · 0 评论 -
Ural 1052
#include#include#include#include#include#includeusing namespace std;#define nMax 500#define LL long longtypedef pair point ;#define x first#define y seconddouble const eps = 1e-9;int原创 2013-10-22 14:08:59 · 675 阅读 · 0 评论 -
Ural 1046 Geometrical Dreams
Link To The ProblemSokution : 用复数类可以使问题大大简化Code:#include#include#include#include#include#include#include#include#includeusing namespace std;#define nMax 300#define LL long原创 2013-10-22 01:18:41 · 879 阅读 · 0 评论 -
Ural 1030. Titanic
Link To The ProblemCode:#include#include#include#include#include#include#include#includeusing namespace std;#define nMax 300#define LL long long#define rep(i,b,n) for(int原创 2013-10-21 19:16:04 · 603 阅读 · 0 评论 -
Ural 1043
//知识点:基本计算几何#include#include#include#include#include#include#include#includeusing namespace std;#define nMax 300#define LL long long#define rep(i,b,n) for(int (i)=(b);(i)<(n);(i)原创 2013-10-18 12:09:44 · 549 阅读 · 0 评论 -
Ural 1019. Line Painting
Ural 1019. Line Painting直接离散化然后暴力染色。注意离散化的时候在线段头尾都多插一点,否则很容易错。#include#include#include#include#includeusing namespace std;#define nMax 20000int n;char s[20];struct Ask{ int a,b,原创 2013-08-23 16:00:48 · 860 阅读 · 1 评论 -
Ural 1397. Points Game
Ural 1397. Points Game假设玩家A取的石子集合是A,B的是Bval = Sum( distant(pi,pj) ) { i = Sum( distant(pi,pj) ) {i,j belong to Q} - Sum( distant(pi,pj) ) { i belong to B && j belong to Q}我们记录每个石子原创 2013-08-23 13:13:57 · 874 阅读 · 0 评论 -
Ural 1540. Battle for the Ring
Ural 1540. Battle for the Ring题大意就是给你一堆石子,每个石子都有权重,每次取一堆中的一个石子,将这堆石子中所有权重比该石子小的全部拿掉,分成若干堆新石子。不能操作的输。用状态sg[cur][l][r]表示第cur堆石子l 到 r的sg值。记忆化搜索之。。。#include#include#include#include#i原创 2013-08-23 12:39:19 · 791 阅读 · 0 评论 -
Ural 1126. Magnetic Storms
PRO IS HERE单调队列;维护区间长最大m的一个单调递减队列。CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a原创 2013-05-30 14:44:59 · 690 阅读 · 0 评论 -
Ural 1654 Cipher Message
PRO IS HERE简单的StackCODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)原创 2013-05-30 14:10:14 · 787 阅读 · 1 评论 -
Ural 1100
PRO IS HERE简单的桶排序。CODE:#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)#def原创 2013-05-30 13:59:22 · 693 阅读 · 0 评论 -
ural 1039
树型dp.#include#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)#原创 2013-04-22 23:19:24 · 653 阅读 · 0 评论 -
ural 1244
PRO IS HERE简单的背包问题,输出yy一下就可以了。#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(i,a,b) for(i原创 2013-04-22 12:01:12 · 630 阅读 · 0 评论 -
Ural 1003 Parity
PRO IS HERE大意:一段长度为n的路,已知m对信息,信息告诉你某两点之间的距离的奇偶,问你到哪个信息是错的。解答:明显的并查集,保存距离的奇偶,find的时候顺便跟新一下。。。我就是忘记了fa[x] = k查了n久的代码啊,弱菜就是弱啊。。。#include#include#include#include#include#i原创 2013-04-21 23:24:15 · 695 阅读 · 0 评论 -
Ural 1018 树dp
PRO IS HERE树dp:#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(i,a,b) for(int (i)=(a);(i)<原创 2013-04-11 21:26:31 · 612 阅读 · 0 评论 -
ural 1036
PRO IS HERE一道比较简单的dp,比较恶心的是大数。。。直接python AC掉,好开心,纪念一下n,s=raw_input().split()n=int(n)s=int(s)if s%2 == 1: print 0else: s /= 2 b=[] b.append([]) a=[] for i in xrange(0,10): a原创 2013-04-11 22:55:37 · 786 阅读 · 0 评论 -
Uarl 1303
PRO IS HERE其实只是简单的贪心即可,按(x,y) 排序,然后尽量取y大的。。。#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(原创 2013-04-11 20:39:47 · 604 阅读 · 0 评论 -
Ural 1635
我是题目#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(i,a,b) for(int (i)=(a);(i)原创 2013-04-10 23:47:23 · 622 阅读 · 0 评论 -
Ural 1635
#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)#define nMax 10原创 2013-04-10 23:05:37 · 671 阅读 · 0 评论 -
Ural 1741
#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)+原创 2013-04-11 02:13:26 · 548 阅读 · 0 评论 -
Ural 1117
YOU CAN SEE THE PRO HERE#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define PB push_back#define INS insert#define FOR(原创 2013-04-11 01:01:44 · 640 阅读 · 0 评论 -
Ural 1501
PRO IS HERE dp[x][y][z] 表示s[0......x] ,t[0.......y] 之间0,1的个数之差为z-1(z=0,1,2)记忆化搜索就行了 #include#include#include#include#include#include#include#includeusing namespace std;原创 2013-04-23 23:40:51 · 547 阅读 · 0 评论