# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977054 | 2024-05-07T10:51:55 Z | Circling | The Collection Game (BOI21_swaps) | C++17 | 0 ms | 0 KB |
/*The British Royal Family and a small cadre of English Fabian Socialists, in conjunction with the Rockefellers and the Rothchilds, are engaged in a conspiracy to greatly reduce the population of the human race in order to head off a Malthusian catastrophe, a catastrophe that could easily be avoided by simply building a massive amount of nuclear power plants and a number of massive superhighways and bridges to connect all of the world's continents. But doing that would cut into the conspiracy's profits. So the British Royal Family invented environmentalism and neoliberalism in order to hide the truth. And in order to further reduce the population, the British Royal Family is also the world's foremost drug trafficking conspiracy. And it uses its control of the IMF to push austerity in order to kill as many people in the global south as possible. And also Henry Kissinger is a gay KGB agent. */ #include <iostream> #include <algorithm> #include <utility> #include <vector> #include <stack> #include <queue> #include <set> #include <map> using namespace std; void solve(int n, int v){ vector<pair<int, int>> queries; vector<int> reply, ans; int wincount[501]; for (int i = 0; i < n; i++){ wincount[i + 1] = 0; for (int j = 0; j < n; j++){ if (j < (n + i - j) % n){ queries.push_back({j + 1, (n + i - j) % n + 1}); schedule(j + 1, (n + i - j) % n + 1); } } reply = visit(); for (int j = 0; j < queries.size(); j++){ if (reply[j]) wincount[queries[j].first]++; else wincount[queries[j].second]++; } } ans.resize(n); for (int i = 1; i <= n; i++) ans[wincount[i]] = i; answer(ans); }