QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#446339 | #8474. Matrices and Sums | Crysfly# | AC ✓ | 34ms | 10676kb | C++17 | 2.7kb | 2024-06-17 08:33:13 | 2024-06-17 08:33:13 |
Judging History
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 int long long
#define ull unsigned 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);
if(f)x=-x;return x;
}
#define mod 1000000007
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,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 2000005
#define inf 0x3f3f3f3f
int n,a[1005][1005];
signed main()
{
n=read();
if(n&1)puts("No"),exit(0);
puts("Yes");
For(i,1,n) For(j,1,i) a[i][j]=2;
For(i,n/2+1,n) For(j,1,n) a[i][j]=2;
For(i,1,n/2) For(j,1,i) a[i][j]=1;
For(i,n/2+1,n) For(j,n/2+1,i-1) a[i][j]=1;
For(i,1,n) For(j,1,n) cout<<a[i][j]-1<<" \n"[j==n];
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
2
output:
Yes 0 -1 1 1
result:
ok OK, Accepted.
Test #2:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
1
output:
No
result:
ok OK, Accepted.
Test #3:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
3
output:
No
result:
ok OK, Accepted.
Test #4:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
4
output:
Yes 0 -1 -1 -1 0 0 -1 -1 1 1 1 1 1 1 0 1
result:
ok OK, Accepted.
Test #5:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
5
output:
No
result:
ok OK, Accepted.
Test #6:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
6
output:
Yes 0 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 0 0 0 -1 -1 -1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1
result:
ok OK, Accepted.
Test #7:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
7
output:
No
result:
ok OK, Accepted.
Test #8:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
8
output:
Yes 0 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1 -1 -1 -1 0 0 0 0 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1
result:
ok OK, Accepted.
Test #9:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
9
output:
No
result:
ok OK, Accepted.
Test #10:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
10
output:
Yes 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 -1 -1 -1 -1 -1 -1 0 0 0 0 0 -1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1
result:
ok OK, Accepted.
Test #11:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
21
output:
No
result:
ok OK, Accepted.
Test #12:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
37
output:
No
result:
ok OK, Accepted.
Test #13:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
73
output:
No
result:
ok OK, Accepted.
Test #14:
score: 0
Accepted
time: 1ms
memory: 5700kb
input:
100
output:
Yes 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok OK, Accepted.
Test #15:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
233
output:
No
result:
ok OK, Accepted.
Test #16:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
555
output:
No
result:
ok OK, Accepted.
Test #17:
score: 0
Accepted
time: 17ms
memory: 8612kb
input:
666
output:
Yes 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok OK, Accepted.
Test #18:
score: 0
Accepted
time: 30ms
memory: 10004kb
input:
888
output:
Yes 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok OK, Accepted.
Test #19:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
999
output:
No
result:
ok OK, Accepted.
Test #20:
score: 0
Accepted
time: 34ms
memory: 10676kb
input:
1000
output:
Yes 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ...
result:
ok OK, Accepted.