Submission #905098

#TimeUsernameProblemLanguageResultExecution timeMemory
905098MinaRagy06Super Dango Maker (JOI22_dango3)C++17
7 / 100
1562 ms1092 KiB
#include <bits/stdc++.h> #include "dango3.h" #ifdef MINA #include "grader.cpp" #endif using namespace std; #define ll long long void Solve(int n, int m) { vector<int> idx[n]; set<int> s; for (int i = 1; i <= n * m; i++) { s.insert(i); } for (int j = 0; j < n; j++) { for (int i = 0; i < m; i++) { int l = 1, r = s.size(); while (l <= r) { int md = ((l + r) >> 1); int cnt = md; vector<int> x; for (int k = 0; k < j; k++) { x.push_back(idx[k].back()); } for (auto k : s) { x.push_back(k); cnt--; if (cnt == 0) break; } // cout << "Ask "; // for (auto k : x) { // cout << k << ' '; // } int v = Query(x); // cout << ": " << v << '\n'; if (v >= 1) { r = md - 1; } else { l = md + 1; } } int cnt = l, pos = -1; for (auto k : s) { cnt--; pos = k; if (cnt == 0) break; } // cout << pos << '\n'; s.erase(pos); idx[j].push_back(pos); } // for (auto i : idx[j]) { // cout << i << ' '; // } // cout << '\n'; } for (int i = 0; i < m; i++) { vector<int> ans; for (int j = 0; j < n; j++) { ans.push_back(idx[j].back()); idx[j].pop_back(); } Answer(ans); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...