#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;
| ^~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
123 ms |
4344 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |