比赛 |
防止浮躁的小练习v0.4 |
评测结果 |
AAAAAAAAAA |
题目名称 |
苳岑学姐の超电磁炮 |
最终得分 |
100 |
用户昵称 |
sxysxy |
运行时间 |
0.099 s |
代码语言 |
C++ |
内存使用 |
0.33 MiB |
提交时间 |
2016-10-13 19:41:10 |
显示代码纯文本
#include <cstdio>
#include <cstdarg>
#include <cstring>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <functional>
using namespace std;
#define MAXN 1502
struct ball
{
int id;
int pos;
int dir;
bool operator<(const ball &ob) const
{
return pos < ob.pos;
}
}bs[MAXN], tbs[MAXN];
bool cmp(const ball &b1, const ball &b2)
{
return b1.id < b2.id;
}
int rank[MAXN];
int main()
{
freopen("dcball.in", "r", stdin);
freopen("dcball.out", "w", stdout);
int n, l;
scanf("%d %d", &n, &l);
for(int i = 0; i < n; i++)
{
int p, d;
scanf("%d %d", &p, &d);
bs[i].id = i;
bs[i].pos = p;
bs[i].dir = d?-1:1;
}
int m;
scanf("%d", &m);
while(m--)
{
int t;
scanf("%d", &t);
for(int i = 0; i < n; i++)
tbs[i].pos = bs[i].pos + bs[i].dir * t;
sort(bs, bs+n);
for(int i = 0; i < n; i++)rank[bs[i].id] = i;
sort(tbs, tbs+n);
for(int i = 0; i < n; i++)
{
int rk = rank[i];
if(tbs[rk].pos <= 0 || tbs[rk].pos > l)
printf("fire in the hole ");
else
printf("%d ", tbs[rk].pos);
}
puts("");
sort(bs, bs+n);
}
return 0;
}