Submission #797943

#TimeUsernameProblemLanguageResultExecution timeMemory
797943OysterMinerals (JOI19_minerals)C++17
40 / 100
14 ms2312 KiB
#include "minerals.h" #include <vector> #include <utility> std::vector<std::pair<int, int>> ans; void DC(const std::vector<int> &v) { int N = v.size() >> 1; if (N == 1) return ans.push_back({v[0], v[1]}); std::vector<int> vl, vr; for (const int &i : v) { if (Query(i) <= N >> 1) vl.push_back(i); else { Query(i); vr.push_back(i); } } for (const int &i : vl) Query(i); DC(vl); DC(vr); } void Solve(int N) { ans.reserve(N); std::vector<int> v(N << 1); for (int i = 0; i < v.size(); i++) v[i] = i + 1; DC(v); for (const auto &p : ans) Answer(p.first, p.second); }

Compilation message (stderr)

minerals.cpp: In function 'void Solve(int)':
minerals.cpp:25:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for (int i = 0; i < v.size(); i++) v[i] = i + 1;
      |                   ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...