QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#661369 | #5438. Half Mixed | Heliumeow | WA | 139ms | 12516kb | C++20 | 3.3kb | 2024-10-20 15:56:39 | 2024-10-20 15:56:41 |
Judging History
answer
// #pragma GCC optimize(3)
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("inline")
// #pragma GCC optimize("omit-frame-pointer")
#include<bits/stdc++.h>
// #include<bits/extc++.h>
#define rep(a,b,c) for (int a=b;a<=c;a++)
#define per(a,b,c) for (int a=b;a>=c;a--)
#define repIt(it,ctner) for (auto it=ctner.begin();it!=ctner.end();it++)
#define perIt(it,ctner) for (auto it=ctner.rbegin();it!=ctner.rend();it++)
#define repAdj(i,h,ne,u) for(int i=h[u];i;i=ne[i])
#define setValue(ctner,val) memset(ctner,val,sizeof ctner)
#define output(a,b,c) cout<<a<<" "<<b<<" "<<c<<"\n";
#define ft first
#define sd second
using namespace std;
// using namespace __gnu_cxx;
// using namespace __gnu_pbds;
typedef long long LL;
typedef long long ll;
typedef unsigned long long ULL;
typedef unsigned long long ull;
typedef __int128 LLL;
typedef __int128 lll;
typedef long double LD;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
typedef pair<int,LL> PIL;
typedef pair<double,int> PDI;
void LLLread(LLL &x){
x=0;int f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
if(f==-1) x=-x;
}
void LLLwrite(LLL x){
if(x<0) putchar('-'),x=-x;
if(x>9) LLLwrite(x/10);
putchar(x%10+'0');
}
//random
LL rnd(const LL &mn = 0, const LL &mx = 100) {
LL x = mn + ((rand()<<15) + rand()) % (mx - mn + 1);
return x;
};
//gcd
LL gcd(LL a,LL b){
return __gcd(a,b);
}
//lcm
LL lcm(LL a,LL b){
return a/__gcd(a,b)*b;
}
int _T=1;
const int N=1e6+5,M=3*N;
const LL mod1=998244353,mod2=1e9+7;
const int imod[4]={39983,39989,39979,39971};
const LL MAXLL=1e18;
const int MAXINT=1e9+1;
const long double pi=acos(-1.0);
const long double eps=1e-10;
//const double phi=(1+sqrt(5))/2;
const string alphabet="abcdefghijklmnopqrstuvwxyz";
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const LL mod=mod1;
LL ip2[N];
void init(){
rep(i,1,N-1){
ip2[i]=i*i;
}
}
int a[N];
int n,m,pos,nowbit;
bool flag;
void fill(int len){
nowbit=!nowbit;
rep(i,1,len){
pos++;
a[pos]=nowbit;
}
}
bool check(int x){
return x%4==0||x%4==3;
}
void solve(){
cin>>n>>m;
flag=1;
if(!check(m)){
swap(n,m);
flag=0;
if(!check(m)){
cout<<"No\n";
return;
}
}
LL tar=(LL)m*((LL)m-1)/2;
pos=0;
per(i,m,1){
if(tar>=ip2[i]){
if(tar-ip2[i]+i+pos<m) continue;
int tms=tar/ip2[i];
rep(j,1,tms){
fill(i);
}
tar%=ip2[i];
if(tar==0) break;
}
}
cout<<"Yes\n";
// cout<<pos<<"\n";
if(flag){
rep(i,1,n){
rep(j,1,m){
cout<<a[j]<<" ";
}
cout<<"\n";
}
}else{
rep(i,1,m){
rep(j,1,n){
cout<<a[i]<<" ";
}
cout<<"\n";
}
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
srand(time(0));
init();
cin>>_T;
rep(i,1,_T){
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 12516kb
input:
2 2 3 1 1
output:
Yes 1 0 1 1 0 1 No
result:
ok OK, Accepted. (2 test cases)
Test #2:
score: -100
Wrong Answer
time: 139ms
memory: 12508kb
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 1 0 1 No Yes 0 1 0 Yes 1 1 0 1 Yes 0 1 0 0 1 0 Yes 1 1 0 0 1 1 Yes 0 0 1 0 No Yes 1 1 0 1 1 1 0 1 Yes 0 1 0 0 1 0 0 1 0 Yes 1 1 1 1 0 0 1 1 No No No Yes 0 0 1 0 0 0 1 0 0 0 1 0 Yes 1 0 1 1 0 1 1 0 1 1 0 1 No No Yes 0 0 0 0 1 1 0 No Yes 1 1 1 1 1 0 0 0 0 0...
result:
wrong answer 197 Mixed Submatrices Found, but 203 Expected (test case 379)