답안 #1060864

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060864 2024-08-16T03:32:27 Z kunzaZa183 Monster Game (JOI21_monster) C++17
10 / 100
157 ms 4340 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";

  vector<int> ans(N);
  for (int i = 0; i < vi.size(); i++)
    ans[vi[i]] = i;

  return ans;
}

Compilation message

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:44:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |   for (int i = 0; i < vi.size(); i++)
      |                   ~~^~~~~~~~~~~
monster.cpp: At global scope:
monster.cpp:7:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
    7 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 124 ms 344 KB Output is correct
17 Correct 109 ms 344 KB Output is correct
18 Correct 100 ms 572 KB Output is correct
19 Correct 126 ms 600 KB Output is correct
20 Correct 120 ms 576 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 105 ms 576 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 95 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 124 ms 344 KB Output is correct
17 Correct 109 ms 344 KB Output is correct
18 Correct 100 ms 572 KB Output is correct
19 Correct 126 ms 600 KB Output is correct
20 Correct 120 ms 576 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 105 ms 576 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 95 ms 572 KB Output is correct
33 Incorrect 157 ms 4332 KB Wrong Answer [6]
34 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 136 ms 4340 KB Wrong Answer [6]
2 Halted 0 ms 0 KB -