Submission #894982

#TimeUsernameProblemLanguageResultExecution timeMemory
894982AlcabelMonster Game (JOI21_monster)C++17
0 / 100
119 ms596 KiB
#include <bits/stdc++.h> #ifndef LOCAL #include "monster.h" #endif using namespace std; vector<int> Solve(int n) { vector<int> cntWin(n); for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { if (Query(i, j)) { ++cntWin[i]; } else { ++cntWin[j]; } } } vector<int> order(n); iota(order.begin(), order.end(), 0); sort(order.begin(), order.end(), [&](const int& A, const int& B) { return cntWin[A] < cntWin[B]; }); if (Query(order[1], order[0])) { swap(order[0], order[1]); } if (Query(order[n - 1], order[n - 2])) { swap(order[n - 2], order[n - 1]); } return order; } /* void solve() { } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); int T = 1; cin >> T; while (T--) { solve(); cerr << "-----------\n"; cout << "-----------\n"; } #else int T = 1; // cin >> T; while (T--) { solve(); } #endif return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...