fzu 1894 单调队列
2014-07-17 14:29
148 查看
http://acm.fzu.edu.cn/problem.php?pid=1894
View Code
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <iostream> typedef struct Node { int num; char name[10]; int data; }queue; queue f[1000010]; int main() { int n,m,i,j,tail,head; scanf("%d",&n); queue tmp; while(n--) { char cur[10]; int Num=0,count=0; head=0,tail=-1; while(scanf("%s",cur)!=EOF) { if(cur[0]=='C') { scanf("%s%d",tmp.name,&tmp.data); tmp.num=++Num; while(head<=tail && f[tail].data<tmp.data) { tail--; } f[++tail]=tmp; } if(cur[0]=='S')continue; if(cur[0]=='E')break; if(cur[0]=='Q') { while(tail>=head && f[head].num<=count) { head++; } if(head>tail)printf("-1\n"); else printf("%d\n",f[head].data); } if(cur[0]=='G') { count++; } } } return 0; }
View Code
相关文章推荐
- FZU 1894 — 志愿者选拔 单调队列
- FZU 1894 志愿者选拔[双端队列/单调队列]
- FZU 1894 志愿者选拔 (单调队列)
- 【单调队列】FZU 1894 志愿者选拔
- fzu 1894 志愿者选拔 (单调队列)
- FZU 1894 志愿者选拔 单调队列
- FZU 1894 志愿者选拔[双端队列/单调队列]
- fzu-1894 志愿者选拔-单调队列
- FZU 1894 单调队列入门
- 单调队列裸题 fzu 1894 志愿者选拔
- FZU - 1894 志愿者选拔 单调队列
- FZU 1894 志愿者选拔 - 单调队列
- FZU1894 志愿者选拔 --单调队列
- FZU 1894 志愿者选拔 单调队列 题解
- FZU 1894 志愿者选拔【单调队列】【monotone decreasing queue】
- FZU 1894 志愿者选拔(单调队列)
- FZU 1894 志愿者选拔 单调队列
- fzu 1894 志愿者选拔 单调队列的学习
- FZU 1894(志愿者选拔-裸的单调队列)
- FZU 1894 志愿者选拔(单调队列)