Submission #1052241

#TimeUsernameProblemLanguageResultExecution timeMemory
1052241SacharlemagneMonster Game (JOI21_monster)C++17
Compilation error
0 ms0 KiB
#include "monster.h" using namespace std; namespace { bool example_variable; } // namespace vector<int> Solve(int N) { vector<int> v(N), ans(N); for (int i = 0; i<N; ++i) { ans[i] = i; for (int j = i+1; j<N; ++j) { ++v[Query(i,j) ? i : j]; } } sort(ans.begin(), ans.end(), [&](int a, int b) {return v[a] < v[b];}); if (!Query(ans[0], ans[1])) swap(ans[0], ans[1]); if (!Query(ans[N-2], ans[N-1])) swap(ans[N-2], ans[N-1]); }

Compilation message (stderr)

monster.cpp: In function 'std::vector<int> Solve(int)':
monster.cpp:17:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   17 |     sort(ans.begin(), ans.end(), [&](int a, int b) {return v[a] < v[b];});
      |     ^~~~
      |     short
monster.cpp:22:1: warning: no return statement in function returning non-void [-Wreturn-type]
   22 | }
      | ^
monster.cpp: At global scope:
monster.cpp:5:6: warning: '{anonymous}::example_variable' defined but not used [-Wunused-variable]
    5 | bool example_variable;
      |      ^~~~~~~~~~~~~~~~