QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#111918 | #5438. Half Mixed | shihoghmean | WA | 31ms | 5500kb | C++17 | 2.3kb | 2023-06-09 10:02:55 | 2023-06-09 10:02:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fr(i,a,b) for(int i=a;i>=b;i--)
#define py puts("Yes")
#define pn puts("No")
#define pt puts("")
#define pb push_back
#define wt(x) write(x),puts("")
#define wr(x) write(x) ,putchar(' ')
#define tx printf("fds")
#define mp make_pair
#define fi first
#define se second
inline int read(){
int x=0,k=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') k=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+ch-48;
ch=getchar();
}
return x*k;
}
void write(int x){
if(x<0){
x=-x;
putchar('-');
}
if(x>9) write(x/10);
putchar(x%10+'0');
}
int power(int x,int y,int mod){
int num=1;
while(y){
if(y&1) num=(num*x)%mod;
x=x*x%mod;
y>>=1;
}
return num;
}
int mul(int x,int y,int mod){
int num=0;
while(y){
if(y&1) num=(num+x)%mod;
x=(x+x)%mod;
y>>=1;
}
return num;
}
const int N=1e6+7,mod=998244353;
int n,m,tot,cnt,ans,k;
int a,b;
int c[N];
int st[N],top;
int get(int x){
int l=1,r=x,p=1;
while(l<=r){
int mid=(l+r)>>1;
if(mid*(mid+1)/2<=x) l=mid+1,p=mid;
else r=mid-1;
}
return p;
}
signed main(){
int tt=read();
while(tt--){
n=read();
m=read();
if(((n+1)*n*m*(m+1)/4)%2==1){
pn;
continue;
}
py;
if(n*(n+1)%4==0){
a=n;b=m;
}
else b=n,a=m;
k=a*(a+1)/4;
int now=a,la=0;
top=0;
fo(i,1,a){
if((k-now)>=(la+1)*(la+2)/2-(la)*(la+1)/2-1){
now+=(la+1)*(la+2)/2-(la)*(la+1)/2-1;
la++;
}
else{
st[++top]=la;
la=1;
}
}
st[++top]=la;
int now1=0,tp=0;
fo(i,1,top){
fo(j,1,st[top]) c[++now1]=tp;
tp^=1;
}
if(n*(n+1)%4==0){
fo(i,1,n){
fo(j,1,m){
wr(c[i]);
}
pt;
}
}
else{
fo(i,1,n){
fo(j,1,m){
wr(c[j]);
}
pt;
}
}
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 5500kb
input:
2 2 3 1 1
output:
Yes 0 1 0 0 1 0 No
result:
ok OK, Accepted. (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 31ms
memory: 3476kb
input:
5382 1 1 1 2 2 1 1 3 2 2 3 1 1 4 2 3 3 2 4 1 1 5 2 4 3 3 4 2 5 1 1 6 2 5 3 4 4 3 5 2 6 1 1 7 2 6 3 5 4 4 5 3 6 2 7 1 1 8 2 7 3 6 4 5 5 4 6 3 7 2 8 1 1 9 2 8 3 7 4 6 5 5 6 4 7 3 8 2 9 1 1 10 2 9 3 8 4 7 5 6 6 5 7 4 8 3 9 2 10 1 1 11 2 10 3 9 4 8 5 7 6 6 7 5 8 4 9 3 10 2 11 1 1 12 2 11 3 10 4 9 5 8 6 ...
output:
No No No Yes 0 1 0 No Yes 0 1 0 Yes 0 1 0 0 Yes 0 1 0 0 1 0 Yes 0 0 1 1 0 0 Yes 0 1 0 0 No Yes 0 1 0 0 0 1 0 0 Yes 0 0 0 1 1 1 0 0 0 Yes 0 0 1 1 0 0 0 0 No No No Yes 0 0 0 0 1 1 1 1 0 0 0 0 Yes 0 0 0 1 1 1 0 0 0 0 0 0 No No Yes 0 1 0 0 0 0 0 No Yes 0 0 0 0 0 1 1 1 1 1...
result:
wrong answer 11 Mixed Submatrices Found, but 14 Expected (test case 22)