QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#106470#2072. Junk ProblemCrysflyWA 2ms3328kbC++174.1kb2023-05-17 20:58:422023-05-17 20:58:44

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-17 20:58:44]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3328kb
  • [2023-05-17 20:58:42]
  • 提交

answer

// what is matter? never mind.
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
//#define int long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

int mod;
struct modint{
	int x;
	modint(int o=0){x=o;}
	modint &operator = (int o){return x=o,*this;}
	modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
	modint &operator -=(modint o){return x=x-o.x<0?x-o.x+mod:x-o.x,*this;}
	modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
	modint &operator ^=(int b){
		modint a=*this,c=1;
		for(;b;b>>=1,a*=a)if(b&1)c*=a;
		return x=c.x,*this;
	}
	modint &operator /=(modint o){return *this *=o^=mod-2;}
	friend modint operator +(modint a,modint b){return a+=b;}
	friend modint operator -(modint a,modint b){return a-=b;}
	friend modint operator *(modint a,modint b){return a*=b;}
	friend modint operator /(modint a,modint b){return a/=b;}
	friend modint operator ^(modint a,int b){return a^=b;}
	friend bool operator ==(modint a,int b){return a.x==b;}
	friend bool operator !=(modint a,int b){return a.x!=b;}
	bool operator ! () {return !x;}
	modint operator - () {return x?mod-x:0;}
	bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}

vector<modint> fac,ifac,iv;
inline void initC(int n)
{
	if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
	int m=iv.size(); ++n;
	if(m>=n)return;
	iv.resize(n),fac.resize(n),ifac.resize(n);
	For(i,m,n-1){
		iv[i]=iv[mod%i]*(mod-mod/i);
		fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
	}
}
inline modint C(int n,int m){
	if(m<0||n<m)return 0;
	return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 55
#define inf 0x3f3f3f3f
#define poly vector<modint>

int n,p,k;

poly operator +(poly a,poly b){
	int n=max(a.size(),b.size());a.resize(n),b.resize(n);
	For(i,0,n-1)a[i]+=b[i];return a;
}
poly operator -(poly a,poly b){
	int n=max(a.size(),b.size());a.resize(n),b.resize(n);
	For(i,0,n-1)a[i]-=b[i];return a;
}
poly operator *(poly a,modint b){
	int n=a.size();
	For(i,0,n-1)a[i]*=b;return a;
} 
poly operator *(poly a,poly b){
	if(!a.size()||!b.size())return {};
	poly c(a.size()+b.size()-1,0);
	for(int i=0;i<a.size();++i)
		for(int j=0;j<b.size();++j)
			c[i+j]+=a[i]*b[j];
	return c;
}

poly operator %(poly a,poly b){
	while(b.back().x==0)b.pop_back();
	while(1){
		while(a.size()&&a.back().x==0)a.pop_back();
		if(a.size()<b.size())return a;
		int t=a.size()-b.size();
		modint w=a.back()/b.back();
		For(i,0,(int)b.size()-1)a[i+t]-=b[i]*w;
		assert(a.back().x==0);
	}
}

void init(poly &a,int x){
	if(a.size()<k)a.resize(k);
	For(i,0,k-1)a[i]=x%p,x/=p;
}
int get(poly a){
	if(a.size()<k)a.resize(k);
	int res=0;
	Rep(i,k-1,0)res=res*p+a[i].x;
	return res;
}

bool chk(poly a){
	poly b;
	For(i,p,n-1){
		init(b,i);
		poly c=a%b;
		if(!c.size())return 0;
	}
	return 1;
}

poly qwq(){
	poly a(k+1); a[k]=1;
	For(i,1,n-1){
		init(a,i);
		if(chk(a))return a;
	}
	assert(0);
}

int pri[maxn],pc[maxn],tot;
void fj(int n){
	For(i,2,n)
		if(n%i==0){
			pri[++tot]=i;
			while(n%i==0)n/=i,++pc[tot];
		}
}

signed main()
{
	n=read();
	if(n<=2){
		cout<<n<<endl;
		For(i,1,n)cout<<i<<" ";
		exit(0);
	}
	int s=floor(sqrt(0.5*n));
	while(s>(1<<k)-1)++k;
	n=(1<<k);
	mod=p=2;
	poly a;
	a=qwq();//puts("QWQWQ");
//	for(auto x:a)cout<<x.x<<' ';puts(" A");
	vi o;
	For(i,0,s-1){
		poly x; init(x,i);
		poly y=x*x%a*x%a;
		int out=get(y);
		out|=(i<<k);
		o.pb(out);
	}
	cout<<o.size()<<"\n";
	for(int x:o)cout<<x<<" \n"[x==o.back()];
//	set<int>S;
//	For(i,0,s-1)
//		For(j,i+1,s-1){
//			if(S.count(o[i]^o[j])) assert(0);
//			S.insert(o[i]^o[j]);
//		}
	return 0;
}
// (1 0 1) % 

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3328kb

input:

49

output:

4
0 9 19 28

result:

wrong answer Integer parameter [name=a[i]] equals to 0, violates the range [1, 49]