Submission #574576

#TimeUsernameProblemLanguageResultExecution timeMemory
574576erekleSuper Dango Maker (JOI22_dango3)C++17
100 / 100
3769 ms812 KiB
#include "dango3.h" #include <vector> using namespace std; bool allDistinct(vector<int> &v, int N, int M) { vector<int> u; // v must be in increasing order for (int i = 1, j = 0; i <= N * M; ++i) { if (j < v.size() && v[j] == i) j++; else u.push_back(i); } return Query(u) == M - 1; } void Solve(int N, int M) { vector<vector<int>> pile(M); for (int i = 1; i <= N * M; ++i) { int left = -1, right = M - 1; while (left + 1 < right) { int mid = (left + right) / 2; pile[mid].push_back(i); if (allDistinct(pile[mid], N, M)) right = mid; else left = mid; pile[mid].pop_back(); } pile[right].push_back(i); } for (vector<int> &p : pile) Answer(p); }

Compilation message (stderr)

dango3.cpp: In function 'bool allDistinct(std::vector<int>&, int, int)':
dango3.cpp:10:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |         if (j < v.size() && v[j] == i) j++;
      |             ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...