QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#459305 | #8830. Breaking Bad | ucup-team1447# | WA | 868ms | 5916kb | C++14 | 1.4kb | 2024-06-30 01:09:43 | 2024-06-30 01:09:44 |
Judging History
answer
// This Code was made by Chinese_zjc_.
#include <bits/stdc++.h>
std::mt19937 Rand(std::chrono ::system_clock::now().time_since_epoch().count());
int n, a[1024][1024], b[1024][1024], p[1024], q[1024], ans;
int plus(int A, int B)
{
int res = 0;
for (int i = 0; i != 5; ++i)
if (B >> i & 1)
res |= A << i;
return (res | res >> 5) & ((1 << 5) - 1);
}
int solve(int xl, int xr, int yl, int yr)
{
if (xr - xl == 1 && yr - yl == 1)
return 1 << b[xl][yl];
int xm = (xl + xr) >> 1, ym = (yl + yr) >> 1;
return plus(solve(xl, xm, yl, ym), solve(xm, xr, ym, yr)) | plus(solve(xm, xr, yl, ym), solve(xl, xm, ym, yr));
}
signed main()
{
std::ios::sync_with_stdio(false);
std::cin >> n;
for (int i = 0; i != n; ++i)
for (int j = 0; j != n; ++j)
std::cin >> a[i][j];
while (n & (n - 1))
++n;
std::iota(p, p + n, 0);
std::iota(q, q + n, 0);
do
{
std::shuffle(p, p + n, Rand);
std::shuffle(q, q + n, Rand);
for (int i = 0; i != n; ++i)
for (int j = 0; j != n; ++j)
b[p[i]][q[j]] = a[i][j];
ans |= solve(0, n, 0, n);
} while (clock() < 0.9 * CLOCKS_PER_SEC);
for (int i = 0; i != 5; ++i)
std::cout << (ans >> i & 1 ? "Y" : "N");
std::cout << std::endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 431ms
memory: 5856kb
input:
2 0 4 4 0
output:
YNNYN
result:
ok "YNNYN"
Test #2:
score: 0
Accepted
time: 458ms
memory: 5888kb
input:
2 1 1 1 1
output:
NNYNN
result:
ok "NNYNN"
Test #3:
score: 0
Accepted
time: 637ms
memory: 5748kb
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: 617ms
memory: 5892kb
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: 868ms
memory: 5916kb
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'