QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#835157#5095. 九王唱Made_in_Code0 0ms3684kbC++141.0kb2024-12-28 10:07:162024-12-28 10:07:17

Judging History

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

  • [2024-12-28 10:07:17]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3684kb
  • [2024-12-28 10:07:16]
  • 提交

answer

#include <iostream>
#include <random>

using namespace std;

const int kMaxN = 5001;
int n, a[kMaxN][kMaxN];

void Input() {
  int seed;
  cin >> n >> seed;
  if (seed) {
    mt19937 Rand(seed);
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j <= n; j++) {
        swap(a[i][j] = j, a[i][Rand() % (j + 1)]);
      }
    }
  } else {
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j <= n; j++) {
        cin >> a[i][j], a[i][j]--;
      }
    }
  }
}

int Calc(int x) {
  static bool b[kMaxN];
  for (int i = 0; i <= n; i++) {
    b[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    x = x == 1 ? n : x - 1;
    for (int j = 0; j <= n; j++) {
      if (!b[a[x][j]]) {
        b[a[x][j]] = 1;
        break;
      }
    }
  }
  for (int i = 0; i <= n; i++) {
    if (!b[i]) {
      return i;
    }
  }
  return -1;
}

int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(0);
  Input();
  for (int i = 1; i <= n; i++) {
    cout << Calc(i) + 1 << " \n"[i == n];
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 0ms
memory: 3624kb

input:

8 0
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5

output:

5 5 5 5 5 5 5 5

result:

ok 8 numbers

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 3684kb

input:

8 0
4 7 8 6 1 3 2 9 5
5 8 9 7 2 4 3 1 6
6 9 1 8 3 5 4 2 7
7 1 2 9 4 6 5 3 8
8 2 3 1 5 7 6 4 9
9 3 4 2 6 8 7 5 1
1 4 5 3 7 9 8 6 2
2 5 6 4 8 1 9 7 3

output:

3 3 3 3 3 3 3 3

result:

wrong answer 1st numbers differ - expected: '7', found: '3'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%