QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#860244#8830. Breaking Badship2077WA 0ms5720kbC++231.2kb2025-01-18 11:33:502025-01-18 11:33:51

Judging History

你现在查看的是最新测评结果

  • [2025-01-18 11:33:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5720kb
  • [2025-01-18 11:33:50]
  • 提交

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 0;
    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);
        break;
    }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: 0ms
memory: 5712kb

input:

2
0 4
4 0

output:

YNNYN

result:

ok "YNNYN"

Test #2:

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

input:

2
1 1
1 1

output:

NNYNN

result:

ok "NNYNN"

Test #3:

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

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: 0ms
memory: 5496kb

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: 0ms
memory: 5716kb

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:

NNNNY

result:

wrong answer 1st words differ - expected: 'NYNNY', found: 'NNNNY'