QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#860221 | #8830. Breaking Bad | ship2077 | WA | 906ms | 5712kb | C++23 | 1.2kb | 2025-01-18 11:23:23 | 2025-01-18 11:23:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
mt19937 mt(random_device{}());
constexpr int M=1005;
int n,ans,px[M],py[M],a[M][M],b[M][M];
int read(){
int x=0;char ch=getchar();
while (!isdigit(ch)) ch=getchar();
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x;
}
int merge(int a,int b){
int ans=0;
for (int i=0;i<5;i++)
if (a>>i&1) ans|=b<<i;
return (ans&31)|(ans>>5);
}
int query(int xl,int xr,int yl,int yr){
if (xl>xr||yl>yr) return 1;
if (xl==xr&&yl==yr) return 1<<b[xl][yl];
int midx=xl+xr>>1,midy=yl+yr>>1;
return merge(query(xl,midx,yl,midy),query(midx+1,xr,midy+1,yr))|
merge(query(xl,midx,midy+1,yr),query(midx+1,xr,yl,midy));
}
int main(){ n=read();
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
a[i][j]=read();
iota(px,px+n+1,0);
iota(py,py+n+1,0);
do{
shuffle(px+1,px+n+1,mt);
shuffle(py+1,py+n+1,mt);
for (int i=1;i<=n;i++)
for (int j=1;j<=n;j++)
b[px[i]][py[j]]=a[i][j];
ans|=query(1,n,1,n);
}while(clock()<CLOCKS_PER_SEC*0.99);
for (int i=0;i<5;i++) putchar(ans>>i&1?'Y':'N');
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 438ms
memory: 5648kb
input:
2 0 4 4 0
output:
YNNYN
result:
ok "YNNYN"
Test #2:
score: 0
Accepted
time: 453ms
memory: 5588kb
input:
2 1 1 1 1
output:
NNYNN
result:
ok "NNYNN"
Test #3:
score: 0
Accepted
time: 646ms
memory: 5712kb
input:
4 0 0 1 0 0 1 0 1 0 0 0 0 1 1 0 0
output:
YYYYN
result:
ok "YYYYN"
Test #4:
score: 0
Accepted
time: 632ms
memory: 5688kb
input:
4 0 0 0 1 0 1 0 1 1 0 0 0 0 1 0 0
output:
YYYYN
result:
ok "YYYYN"
Test #5:
score: -100
Wrong Answer
time: 906ms
memory: 5624kb
input:
10 1 4 2 0 0 2 0 1 3 3 0 3 1 4 4 1 4 0 2 2 1 4 2 0 0 2 0 1 0 3 0 3 1 4 4 1 4 0 2 2 4 2 0 3 3 0 3 4 1 1 2 0 3 1 1 3 1 2 4 4 4 2 0 3 3 0 3 4 1 1 2 0 3 1 1 3 1 2 4 4 1 4 2 0 0 2 0 1 3 3 3 1 4 2 2 4 2 3 0 0
output:
YYYYY
result:
wrong answer 1st words differ - expected: 'NYNNY', found: 'YYYYY'