QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#120559#3273. Datalabzhouhuanyi0 10ms3976kbC++111.3kb2023-07-06 21:35:242023-07-06 21:35:26

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-06 21:35:26]
  • 评测
  • 测评结果:0
  • 用时:10ms
  • 内存:3976kb
  • [2023-07-06 21:35:24]
  • 提交

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