QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#120559 | #3273. Datalab | zhouhuanyi | 0 | 10ms | 3976kb | C++11 | 1.3kb | 2023-07-06 21:35:24 | 2023-07-06 21:35:26 |
Judging History
answer
#include"datalab.h"
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#define N 8191
using namespace std;
bitset<N+1>A;
bitset<N+1>B;
int sz,block[N+1],ps[N+1],cl[N+1],cls[N+1];
vector<int>solve(int k,int LIMIT)
{
int rt,d;
bool op;
vector<int>p(k);
p[k-2]=-1,p[k-1]=1,sz=sqrt(k-2);
for (int i=0;i<=k-3;++i) block[i]=i/sz;
for (int i=0;i<=block[k-3];++i) ps[i]=i*sz;
while (1)
{
A.reset(),op=0;
for (int i=0;i<=block[k-3];++i)
if (ps[i]<=min((i+1)*sz-1,k-3))
A[ps[i]]=op=1;
if (!op) break;
B=Add(A,A);
for (int i=0;i<=block[k-3];++i)
if (ps[i]<=min((i+1)*sz-1,k-3))
{
rt=0;
for (int j=ps[i]+1;j<=min((i+1)*sz-1,k-3)+1;++j)
{
if (B[j]) rt=j;
else break;
}
for (int j=ps[i]+1;j<=rt-1;++j) cl[j]=(!cl[ps[i]]);
if (rt<=min((i+1)*sz-1,k-3)) cl[rt]=cl[ps[i]];
if (rt==min((i+1)*sz-1,k-3)+1) cls[i]=(ps[i]==min((i+1)*sz-1,k-3));
ps[i]=rt;
if (rt==min((i+1)*sz-1,k-3)+1) break;
}
}
for (int i=block[k-3];i>=0;--i)
{
d=min((i+1)*sz-1,k-3);
if (!cls[i]) A.reset(),A[d]=1,B=Add(A,A),cls[i]=(!B[d+2]);
for (int j=i*sz;j<=d;++j)
{
if (cl[d]^cl[j]^cls[i]) p[j]=p[d+1];
else p[j]=-p[d+1];
}
}
return p;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 10ms
memory: 3976kb
output:
WA WA on 180th number,1 found,-1 expected
result:
wrong answer
Subtask #2:
score: 0
Wrong Answer
Test #14:
score: 0
Wrong Answer
time: 10ms
memory: 3916kb
output:
WA WA on 270th number,1 found,-1 expected
result:
wrong answer
Subtask #3:
score: 0
Wrong Answer
Test #46:
score: 0
Wrong Answer
time: 10ms
memory: 3916kb
output:
WA WA on 0th number,1 found,-1 expected
result:
wrong answer