Submission #1060869

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10608692024-08-16 03:45:4512345678Monster Game (JOI21_monster)C++17
10 / 100
107 ms856 KiB
#include "monster.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=205;
int n, dp[nx][nx], cnt[nx];
std::vector<int> Solve(int N) {
n=N;
for (int i=0; i<n; i++) for (int j=i+1; j<n; j++) dp[i][j]=Query(i, j), dp[j][i]=!dp[i][j], cnt[i]+=dp[i][j], cnt[j]+=dp[j][i];
vector<pair<int ,int>> v;
for (int i=0; i<n; i++) v.push_back({cnt[i], i});
sort(v.begin(), v.end());
vector<int> res(n), ans(n);
for (int i=0; i<n; i++) res[i]=v[i].second;
if (!dp[res[0]][res[1]]) swap(res[0], res[1]);
if (!dp[res[n-2]][res[n-1]]) swap(res[n-2], res[n-1]);
for (int i=0; i<n; i++) ans[res[i]]=i;
/*
cout<<"res ";
for (auto x:res) cout<<x<<' ';
cout<<'\n';
cout<<"ans ";
for (auto x:ans) cout<<x<<' ';
cout<<'\n';
*/
return ans;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...