Submission #1060863

# Submission time Handle Problem Language Result Execution time Memory
1060863 2024-08-16T03:29:30 Z kunzaZa183 Monster Game (JOI21_monster) C++17
0 / 100
123 ms 4344 KB
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;

namespace {

bool example_variable;

} // namespace

vector<int> Solve(int N) {
  vector<vector<int>> vvi(N, vector<int>(N, 0));
  for (int i = 0; i < N; i++)
    for (int j = i + 1; j < N; j++) {
      vvi[i][j] = Query(i, j);
      vvi[j][i] = 1 - vvi[i][j];
    }

  vector<int> wincount(N);
  for (int i = 0; i < N; i++) {
    wincount[i] = count(vvi[i].begin(), vvi[i].end(), 1);
  }

  vector<int> vi(N);
  iota(vi.begin(), vi.end(), 0);

  // for (auto a : vvi) {
  //   for (auto b : a)
  //     cout << b << " ";
  //   cout << "\n";
  // }

  sort(vi.begin(), vi.end(), [&](int a, int b) {
    if (wincount[a] != wincount[b])
      return wincount[a] < wincount[b];
    return bool(vvi[a][b]);
  });

  // for (auto a : vi)
  //   cout << a << " ";
  // cout << "\n";

  return vi;
}

Compilation message

monster.cpp:7:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
    7 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong Answer [3]
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 4344 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -