Codeforces Round #279 (Div. 2) B. Queue】的更多相关文章

B. Queue time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food cou…
这道题不错,思维上不难想到规律,但是如何写出优雅的代码比较考功力. 首先第一个人的序号可以确定,那么接下来所有奇数位的序号就可以一个连一个的确定了.然后a[i].first==0时的a[i].secod就是第二个人的序号,然后偶数位的序号也可以一个连一个的确定了. 用一个next数组,其下标就是a[i].first,其值就是a[i].second,这样巧妙地使用数组下标就解决了“串链子”这个难点,我之前想的每次用二分来找真是弱爆了.. 而在找第一个人的序号时也是妙用flag数组下标. #incl…
#include<iostream> #include<mem.h> using namespace std; ],q[]; int main() { int n,x,y; memset(q,,sizeof(q)); cin>>n; while(n) { cin>>x>>y; p[x]=y; q[x]++; q[y]--; n--;//p[x]表示在x之后两位的数是什么 //q[x]表示x这个数究竟有多少个 } ; while(true) { )…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
题目传送门 /* 比C还水... */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream> using namespace std; typedef long long ll; ; const int INF = 0x3f3f3f3f; ll a[MAXN]; int main(void) //Codeforc…
这题看别人的.就是那么诚实.http://www.cnblogs.com/zhyfzy/p/4117481.html B. Queue During the lunch break all n Berland State University students lined up in the food court. However, it turned out that the food court, too, has a lunch break and it temporarily stopp…
终于有场正常时间的比赛了...毛子换冬令时还正是好啊233 做了ABCD,E WA了3次最后没搞定,F不会= = 那就来说说做的题目吧= = A. Team Olympiad 水题嘛= = 就是个贪心什么的乱搞,貌似放A题难了 #include <cstdio> #include <algorithm> using namespace std; ; ], first[], next[N]; int main() { int n ,i, x, ans; int a, b, c; sc…
C. Woodcutters Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/D Description Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For ea…
#include <cstdio> #include <cmath> #include <cstring> #include <ctime> #include <iostream> #include <algorithm> #include <set> #include <vector> #include <sstream> #include <queue> #include <t…
题目链接:http://codeforces.com/problemset/problem/545/D 题解: 问经过调整,最多能使多少个人满意. 首先是排序,然后策略是:如果这个人对等待时间满意,则将其加入队伍中,更新当前的等候时间:如果不满意,既然等待时间最小了都不满意,那把他扔到最后,即跳过他,接着考虑下一个. 代码如下: #include<cstdio>//F - F CodeForces - 545D #include<cstring> #include<cstdl…