比赛 |
2016-10-11 4 syz |
评测结果 |
AAAAAAAAAT |
题目名称 |
无穷的序列 |
最终得分 |
90 |
用户昵称 |
sxysxy |
运行时间 |
1.096 s |
代码语言 |
C++ |
内存使用 |
17.48 MiB |
提交时间 |
2016-10-11 20:24:21 |
显示代码纯文本
#pragma GCC optimize(3)
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <cstring>
#include <functional>
#include <iostream>
using namespace std;
#define BETTER_CODE __attribute__((optimize("O3")))
BETTER_CODE
int fast_read()
{
int r;
char c;
while(c = getchar())
{
if(c >= '0' && c <= '9')
{
r = c^0x30;
break;
}
}
while(isdigit(c = getchar()))
r = (r<<3)+(r<<1)+(c^0x30);
return r;
}
#define MAXN 1500003
struct que
{
int p;
char ans;
}ques[MAXN];
bool cmp(int a, int b)
{
return ques[a].p < ques[b].p || (ques[a].p == ques[b].p && a < b);
}
int rrank[MAXN];
BETTER_CODE
int main()
{
freopen("unlessseq.in", "r", stdin);
freopen("unlessseq.out", "w", stdout);
int n;
int maxp = 0;
n = fast_read();
for(int i = 1; i <= n; i++)
{
int t = fast_read();
maxp = max(maxp, t);
que &q = ques[i];
q.p = t;
rrank[i] = i;
}
sort(rrank+1, rrank+1+n, cmp);
int k = 0;
int pq = 1;
for(int i = 1; i <= maxp; )
{
int tm = i;
int t = k;
tm += t;
while(pq <= n && ques[rrank[pq]].p <= i+t)
{
ques[rrank[pq]].ans = ques[rrank[pq]].p == i? 1:0;
pq++;
}
i = tm+1;
k++;
}
for(int i = 1; i <= n; i++)
{
putchar(ques[i].ans | '0');
putchar('\n');
}
return 0;
}