贪心
yxr0105
这个作者很懒,什么都没留下…
展开
-
5.17pkusc模拟赛3
A.走”日”字,判断从(i,j)到(k,l)最少几步走到。(5.17)#include<iostream> #include<cstdio> #include<cstdlib> #include<algorithm> #include<cstring> #include<queue> using namespace std; int r,c,gr,gc,lr,lc; int dirr[9]={0,1原创 2016-05-18 09:56:00 · 378 阅读 · 0 评论 -
5.21pkusc模拟赛5
A.支持插入,删除rank1,删除rank last的数据结构。。set/map就可以。。我逗比地写了个treap。5.22#include #include #include #define pa pair #define mp make_pair #define N 2000005 #define inf 1<<30 using namespace std; struct T{ int原创 2016-05-23 15:11:36 · 333 阅读 · 0 评论 -
poj1328 Radar Installation
题目大意:在y轴正方向有n个岛屿(n <=1000),在x轴上建立雷达,其覆盖范围是d,求最少建立多少个雷达。 题解:贪心,每个岛屿在[l,r]范围内建立雷达即可覆盖,那么我们有n个区间,我们按照r排序,第一个在r处建立,从左往右扫描,依次建立,如果没被覆盖过,就在r处建雷达(在r总比在l优),复杂度O(n2)O(n^2)。#include<cstdio> #include<algorithm>原创 2017-11-14 13:19:25 · 162 阅读 · 0 评论 -
hoj2143 Songs 贪心
Description John Doe is a famous DJ and, therefore, has the problem of optimizing the placement of songs on his tapes. For a given tape and for each song on that tape John knows the length of the song原创 2017-12-21 15:35:22 · 194 阅读 · 0 评论