QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#710319 | #8830. Breaking Bad | ucup-team134 | WA | 752ms | 6076kb | C++14 | 1.4kb | 2024-11-04 19:25:09 | 2024-11-04 19:25:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=1050;
int a[N][N],b[N][N],n,p[N],q[N];
mt19937 rng(time(0));
void Shuffle(){
iota(p+1,p+1+n,1);
shuffle(p+1,p+1+n,rng);
iota(q+1,q+1+n,1);
shuffle(q+1,q+1+n,rng);
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
b[i][j]=a[p[i]][q[j]];
}
}
}
int Combine(int a,int b){
int ans=0;
for(int i=0;i<5;i++)if(a>>i&1){
for(int j=0;j<5;j++)if(b>>j&1){
ans|=(1<<((i+j)%5));
}
}
return ans;
}
int Solve(int xl,int xr,int yl,int yr){
if(xl==xr || yl==yr){
int ans=0;
for(int i=xl;i<=xr;i++){
for(int j=yl;j<=yr;j++){
ans|=1<<b[i][j];
}
}
return ans;
}
int xm=xl+xr>>1;
int ym=yl+yr>>1;
int A=Solve(xl,xm,yl,ym);
int B=Solve(xl,xm,ym+1,yr);
int C=Solve(xm+1,xr,yl,ym);
int D=Solve(xm+1,xr,ym+1,yr);
return Combine(A,D)|Combine(B,C);
}
int main(){
scanf("%i",&n);
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
scanf("%i",&a[i][j]);
}
}
int ans=0;
while(clock()<0.8*CLOCKS_PER_SEC){
Shuffle();
ans|=Solve(1,n,1,n);
}
for(int i=0;i<5;i++){
if(ans>>i&1)printf("Y");
else printf("N");
}
printf("\n");
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 431ms
memory: 6028kb
input:
2 0 4 4 0
output:
YNNYN
result:
ok "YNNYN"
Test #2:
score: 0
Accepted
time: 426ms
memory: 6040kb
input:
2 1 1 1 1
output:
NNYNN
result:
ok "NNYNN"
Test #3:
score: 0
Accepted
time: 621ms
memory: 6036kb
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: 525ms
memory: 6032kb
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: 752ms
memory: 6076kb
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'