模拟
文章平均质量分 75
wang2147483647
这个作者很懒,什么都没留下…
展开
-
Hdu 5437 Alisha’s Party(模拟)
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5437思路:优先队列模拟,注意最后一次门外人全部进入。#include#include#include#include#include#define debuusing namespace std;const int maxn=150000+50;struct Node{原创 2016-08-04 20:28:18 · 739 阅读 · 0 评论 -
Codeforces Beta Round #95 (Div. 2) E. Yet Another Task with Queens(模拟)
题目地址:http://codeforces.com/problemset/problem/131/E思路:行i,列j,对角线一 i+j,对角线二 i-j 。使用set(有序),若当前皇后对应项(行列对角线)在set一端且元素个数不为1,则该皇后在该项被1皇后攻击。若在set元素中间,则该皇后在该项被2皇后攻击。#include#include#include#include#原创 2016-07-26 20:35:25 · 583 阅读 · 0 评论 -
Codeforces Round #357 (Div. 2) C. Heap Operations(优先队列)
题目地址:http://codeforces.com/problemset/problem/681/C思路:优先队列模拟,注意判断队列为空,若删除时为空,先加入0再删除。#include#include#include#include#include#define debuusing namespace std;const int INF=1e9+1;int n;vect原创 2016-07-26 10:47:18 · 428 阅读 · 0 评论 -
Codeforces Round #199 (Div. 2) B. Xenia and Spies(贪心)
题目地址:http://codeforces.com/problemset/problem/342/B思路:在某时刻,若能传这一直向目标方向传递,若不能则等待。#include#include#include#include#include#includeusing namespace std;const int maxn=1e5+50;struct Node{原创 2016-07-26 09:33:52 · 531 阅读 · 0 评论 -
Codeforces Round #293 (Div. 2) C.Anya and Smartphone(模拟)
题目地址:http://codeforces.com/problemset/problem/518/C思路:模拟即可#include#include#include#include#define debuusing namespace std;const int maxn=1e5+50;int n,m,k;long long ans=0;int order[maxn]原创 2016-07-25 21:43:36 · 524 阅读 · 0 评论 -
UVAlive 6693 Flow Game(模拟)
题目地址:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4705思路:若有解,两点连线最小距离=曼哈顿距离+1,则ans=abs(x1-x2)+abs(y1-y2)+abs(x3-x4)+abs(y3-y4)+2。若无解,则两线相交:对原创 2016-08-23 22:07:38 · 727 阅读 · 0 评论 -
Poj 3658 Artificial Lake(模拟)
题目地址:http://poj.org/problem?id=3658思路:记录每一个平台未被淹没的前一个平台与后一个平台。每次选择一个高度最小的坑,填满。并更新其前后平台,即nt[pre[k]]=nt[k](该平台k被淹没后其前驱平台的后继即为该平台后继平台),pre[nt[k]]=pre[k](该平台被淹没后其后继平台的前驱即为该平台的前驱),ans[k]=当前水量+淹没该平台的宽度(w[原创 2017-03-03 21:46:13 · 844 阅读 · 0 评论 -
UVA 1587 Box(模拟)
题目地址:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=448&page=show_problem&problem=4462思路:分三种面,模拟,注意判断每种面的个数。#include#include#include#include#include#define deb原创 2017-02-25 17:07:49 · 701 阅读 · 0 评论 -
Poj 3106 Flip and Turn(模拟+优化)
题目地址:http://poj.org/problem?id=3106思路:一、模拟+栈优化1、所有操作均对应与两种操作的组合,对应题目中的1和V操作。设1操作为1,V操作为0。则所有操作分别对应:112010H101V0A10B1010C101010原创 2017-10-06 18:56:37 · 573 阅读 · 0 评论