QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#614672#9439. Aim Highucup-team3161#AC ✓0ms3676kbC++143.2kb2024-10-05 16:47:312024-10-05 16:47:31

Judging History

This is the latest submission verdict.

  • [2024-10-05 16:47:31]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3676kb
  • [2024-10-05 16:47:31]
  • Submitted

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#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 ll long long
#define ull unsigned long long
//#define int long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
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);
	return f?-x:x;
}

#define mod 998244353
struct modint{
	unsigned 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?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,modint b){return a.x==b.x;}
	friend bool operator !=(modint a,modint b){return a.x!=b.x;}
	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 200005
#define inf 0x3f3f3f3f

mt19937_64 rnd(time(0));

vector<array<int,6> >vec={
{4,-5,3,-5,3,-4},
{4,-4,3,-4,3,-3},
{3,-4,2,-4,2,-3},
{4,-3,3,-3,3,-2},
{3,-3,2,-3,2,-2},
{2,-3,1,-3,1,-2},
{4,-2,3,-2,3,-1},
{3,-2,2,-2,2,-1},
{2,-2,1,-2,1,-1},
{1,-2,0,-2,0,-1},
{3,-1,2,-1,2,0},
{3,-1,2,-1,2,0},
{0,-1,1,-1,1,0},
{0,-1,1,-1,1,0},
{3,0,2,0,2,1},
{2,0,1,0,1,1},
{2,0,1,0,1,1},
{1,0,0,0,0,1},
{2,1,1,1,1,2},
{1,1,0,1,0,2},
{1,2,0,2,0,3}
};

signed main()
{
	int sz=vec.size();
	For(i,0,sz-1) {
		auto [a,b,c,d,e,f]=vec[i];
		a=-a-1;
		c=-c-1;
		e=-e-1;
		vec.pb({a,b,c,d,e,f});
	}
	vec.pb({-1,3,0,3,0,4});
	int T=read();
	while(T--){
		int n=read();
		if(n>4)puts("-1");
		else{
			cout<<vec.size()<<"\n";
			for(auto [a,b,c,d,e,f]:vec)cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<e<<" "<<f<<"\n";
		}
	}
	return 0;
}
/*
3 1
1 2


3 2
5 6
4 6

6 3
1 2
2 3
3 4
*/

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3676kb

input:

1
1

output:

43
4 -5 3 -5 3 -4
4 -4 3 -4 3 -3
3 -4 2 -4 2 -3
4 -3 3 -3 3 -2
3 -3 2 -3 2 -2
2 -3 1 -3 1 -2
4 -2 3 -2 3 -1
3 -2 2 -2 2 -1
2 -2 1 -2 1 -1
1 -2 0 -2 0 -1
3 -1 2 -1 2 0
3 -1 2 -1 2 0
0 -1 1 -1 1 0
0 -1 1 -1 1 0
3 0 2 0 2 1
2 0 1 0 1 1
2 0 1 0 1 1
1 0 0 0 0 1
2 1 1 1 1 2
1 1 0 1 0 2
1 2 0 2 0 3
-5 -5 -...

result:

ok Output is valid. OK

Test #2:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

6
1
2
3
4
5
6

output:

43
4 -5 3 -5 3 -4
4 -4 3 -4 3 -3
3 -4 2 -4 2 -3
4 -3 3 -3 3 -2
3 -3 2 -3 2 -2
2 -3 1 -3 1 -2
4 -2 3 -2 3 -1
3 -2 2 -2 2 -1
2 -2 1 -2 1 -1
1 -2 0 -2 0 -1
3 -1 2 -1 2 0
3 -1 2 -1 2 0
0 -1 1 -1 1 0
0 -1 1 -1 1 0
3 0 2 0 2 1
2 0 1 0 1 1
2 0 1 0 1 1
1 0 0 0 0 1
2 1 1 1 1 2
1 1 0 1 0 2
1 2 0 2 0 3
-5 -5 -...

result:

ok Output is valid. OK

Extra Test:

score: 0
Extra Test Passed