QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#120555#3273. DatalabzhouhuanyiCompile Error//C++111.1kb2023-07-06 21:29:372023-07-06 21:29:38

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:29:38]
  • 评测
  • [2023-07-06 21:29:37]
  • 提交

answer

#include"datalab.h"
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<cassert>
#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];
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=ps[i]+1;
		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]];
		ps[i]=rt;
	    }
    }
    for (int i=block[k-3];i>=0;--i)
    {
	d=min((i+1)*sz-1,k-3),A.reset(),A[d]=1,B=Add(A,A),res++;
	for (int j=i*sz;j<=d;++j)
	{
	    if (cl[d]^cl[j]^(!B[d+2])) p[j]=p[d+1];
	    else p[j]=-p[d+1];
	}
    }
    return p;
}

Details

answer.code: In function ‘std::vector<int> solve(int, int)’:
answer.code:44:59: error: ‘res’ was not declared in this scope
   44 |         d=min((i+1)*sz-1,k-3),A.reset(),A[d]=1,B=Add(A,A),res++;
      |                                                           ^~~