QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#458579#8830. Breaking Baducup-team3215#WA 1ms3744kbC++201.0kb2024-06-29 17:54:152024-06-29 18:00:02

Judging History

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

  • [2024-06-29 18:00:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3744kb
  • [2024-06-29 17:54:15]
  • 提交

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; t && cmask != (cmask << 5 - t || cmask >> t)) {
      cmask |= cmask << 5 - t || cmask >> 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];
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3696kb

input:

2
0 4
4 0

output:

YNNYN

result:

ok "YNNYN"

Test #2:

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

input:

2
1 1
1 1

output:

NNYNN

result:

ok "NNYNN"

Test #3:

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

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: 3732kb

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'