Submission #1061050

#TimeUsernameProblemLanguageResultExecution timeMemory
1061050thinknoexitMonster Game (JOI21_monster)C++17
10 / 100
146 ms1412 KiB
#include "monster.h" #include<bits/stdc++.h> using namespace std; using ll = long long; int n; bool res[1010][1010]; int cnt[1010]; vector<int> Solve(int N) { n = N; for (int i = 0;i < n;i++) { for (int j = i + 1;j < n;j++) { res[i][j] = Query(i, j); res[j][i] = !res[i][j]; } } for (int i = 0;i < n;i++) { for (int j = 0;j < n;j++) { if (i != j) cnt[i] += res[i][j]; } } vector<pair<int, int>> v; for (int i = 0;i < n;i++) v.push_back({ cnt[i], i }); sort(v.begin(), v.end()); // check (0, 1) if (res[v[1].second][v[0].second]) swap(v[0], v[1]); // check (n-2, n-1) if (res[v[n - 1].second][v[n - 2].second]) swap(v[n - 1], v[n - 2]); if (!(n & 1)) { // check(n/2 - 1, n/2) if (res[v[n / 2].second][v[n / 2 - 1].second]) swap(v[n / 2], v[n / 2 - 1]); } vector<int> ans(n); for (int i = 0;i < n;i++) { ans[v[i].second] = i; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...