Submission #894622

#TimeUsernameProblemLanguageResultExecution timeMemory
894622boris_mihovSuper Dango Maker (JOI22_dango3)C++17
100 / 100
349 ms1208 KiB
#include "dango3.h" #include <algorithm> #include <iostream> #include <numeric> #include <cassert> #include <vector> int n, m; void rec(std::vector <int> elements, int count) { if (count == 1) { assert(elements.size() == n); Answer(elements); return; } std::vector <int> left = elements, right; for (int i = left.size() - 1 ; i >= 0 ; --i) { right.push_back(left[i]); left.erase(left.begin() + i); int res = Query(left); if (res < count / 2) { left.push_back(right.back()); right.pop_back(); } } rec(left, count / 2); rec(right, count / 2 + count % 2); } void Solve(int N, int M) { n = N; m = M; std::vector <int> elements; for (int i = 1 ; i <= n * m ; ++i) { elements.push_back(i); } rec(elements, m); }

Compilation message (stderr)

In file included from /usr/include/c++/10/cassert:44,
                 from dango3.cpp:5:
dango3.cpp: In function 'void rec(std::vector<int>, int)':
dango3.cpp:13:32: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   13 |         assert(elements.size() == n);
      |                ~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...