QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#458548 | #8830. Breaking Bad | ucup-team3215# | WA | 1ms | 3744kb | C++20 | 996b | 2024-06-29 17:51:07 | 2024-06-29 17:52:39 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 1e3;
int a[N][N], p[N];
array<int, 2> mt[N];
int main() {
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
mt19937_64 rng(213132);
for (int i = 0; i < n; p[i] = i, ++i)
for (int j = 0; j < n; ++j) cin >> a[i][j];
int mask{};
for (int _ = 7e2; _--; ) {
shuffle(p, p + n, rng);
vector<int> sel;
int cur = 0;
for (int i = 0; i < n; ++i) mt[i] = {i, p[i]}, cur += a[i][p[i]];
int cmask = 1 << cur % 5;
shuffle(mt, mt + n, rng);
for (int i = 0; i < n; ++i)
for (int j = i + 1; j < n; ++j)
if (auto t = uint32_t(a[mt[i][0]][mt[i][1]] + a[mt[j][0]][mt[j][1]] + 10 - a[mt[i][0]][mt[j][1]] - a[mt[j][0]][mt[i][1]]) % 5) {
cmask |= cmask << t || cmask >> 5 - t;
swap(mt[j], mt[i + 1]);
shuffle(mt + i + 2, mt + n, rng);
++i;
break;
}
mask |= cmask;
}
for (int i = 0; i < 5; ++i) cout << "NY"[mask >> i & 1];
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
input:
2 0 4 4 0
output:
YNNYN
result:
ok "YNNYN"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
2 1 1 1 1
output:
NNYNN
result:
ok "NNYNN"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3576kb
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: 3692kb
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: 1ms
memory: 3728kb
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:
YYNNY
result:
wrong answer 1st words differ - expected: 'NYNNY', found: 'YYNNY'