UVALive 3135 Argus
来源:互联网 发布:类图用什么软件画 编辑:程序博客网 时间:2024/06/08 09:00
给出若干个信息,每个都有独立的编号,以及时间间隔。把他们放入优先队列中,每次取时间最小的(多个就取编号小的),输出编号,再把他的时间加上他的时间间隔,再放入优先队列中,执行n次。
注意优先队列的优先级表示法。
#include<algorithm>#include<iostream>#include<cstring>#include<cstdio>#include<vector>#include<string>#include<queue>#include<cmath>///LOOP#define REP(i, n) for(int i = 0; i < n; i++)#define FF(i, a, b) for(int i = a; i < b; i++)#define FFF(i, a, b) for(int i = a; i <= b; i++)#define FD(i, a, b) for(int i = a - 1; i >= b; i--)#define FDD(i, a, b) for(int i = a; i >= b; i--)///INPUT#define RI(n) scanf("%d", &n)#define RII(n, m) scanf("%d%d", &n, &m)#define RIII(n, m, k) scanf("%d%d%d", &n, &m, &k)#define RIV(n, m, k, p) scanf("%d%d%d%d", &n, &m, &k, &p)#define RV(n, m, k, p, q) scanf("%d%d%d%d%d", &n, &m, &k, &p, &q)#define RFI(n) scanf("%lf", &n)#define RFII(n, m) scanf("%lf%lf", &n, &m)#define RFIII(n, m, k) scanf("%lf%lf%lf", &n, &m, &k)#define RFIV(n, m, k, p) scanf("%lf%lf%lf%lf", &n, &m, &k, &p)#define RS(s) scanf("%s", s)///OUTPUT#define PN printf("\n")#define PI(n) printf("%d\n", n)#define PIS(n) printf("%d ", n)#define PS(s) printf("%s\n", s)#define PSS(s) printf("%s ", n)///OTHER#define pb(x) push_back(x)#define CLR(a, b) memset(a, b, sizeof(a))#define CPY(a, b) memcpy(a, b, sizeof(b))#define display(A, n, m) {REP(i, n){REP(j, m)PIS(A[i][j]);PN;}}using namespace std;typedef long long LL;typedef pair<int, int> P;const int MOD = 100000000;const int INFI = 1e9 * 2;const LL LINFI = 1e17;const double eps = 1e-6;const double pi = acos(-1.0);const int N = 11;const int M = 11;const int move[8][2] = {0, 1, 0, -1, 1, 0, -1, 0, 1, 1, 1, -1, -1, 1, -1, -1};struct node{ int num, p, t; node(){}; node(int a, int b, int c){num = a, p = b, t = c;}; bool operator < (const node a) const { return (a.t == t) ? a.num < num : a.t < t; }}m;priority_queue<node> q;char s[N];int main(){ //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int a, b, n; while(!q.empty())q.pop(); while(cin >> s && s[0] == 'R') { cin >> a >> b; q.push(node(a, b, b)); } cin >> n; while(n--) { m = q.top(); q.pop(); cout << m.num << endl; q.push(node(m.num, m.p, m.p + m.t)); } return 0;}
- UVALive 3135 Argus
- UVALive 3135 Argus
- UVALive - 3135 Argus
- uva UVALive 3135 Argus
- UVALive - 3135 Argus
- UVALive - 3135 Argus 优先队列
- UVALive - 3135 Argus 优先队列
- UVALive - 3135 Argus【优先队列】
- UVALive:Argus
- UVALive - 3135 - Argus (优先队列!!)
- UVALive 3135 Argus(优先队列)
- 【暑假】[实用数据结构]UVAlive 3135 Argus
- UVALive 3135 Argus(优先队列)
- UVALive 3135--Argus+自定义优先队列的优先规则
- 【优先队列之多路归并】UVALive 3135 Argus
- Beijing 2004 / UVa 1203 / UVALive 3135 / ZOJ 2212 Argus (优先队列)
- 指南 第三章 例题3 UVALive 3135 Argus(优先队列的应用)
- LA - 3135 - Argus
- Ubuntu11.04不能更新软件源
- SWING example
- UVA 11991 Easy Problem from Rujia Liu?
- strcmp函数的使用的一个坑
- STL函数对象:定义、及其在STL中的应用
- UVALive 3135 Argus
- UVA 11997 K Smallest Sums
- 一个疑问
- java内存泄漏的定位与分析
- Java线程范围变量——ThreadLocal的模拟和解释
- CentOS查看CPU、内存、网络流量和磁盘 I/O【详细】
- UVALive 3644 X-Plosives
- UVALive 3027 Corporative Network
- RobotFramework+Selenium2环境搭建与入门实例