Submission #565858

#TimeUsernameProblemLanguageResultExecution timeMemory
565858UzoufXylophone (JOI18_xylophone)C++14
0 / 100
1 ms208 KiB
#include "xylophone.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { int df[101][101]; for (int i=1;i<=N;i++) { for (int j=1;j<=N;j++) { df[i][j]=query(i,j); } } map<int,pair<int,int> >mp; for (int i=1;i<=N;i++) { map<int,int> occ; for (int j=1;j<=N;j++) { occ[df[i][j]]++; } for (int chk=N-1;chk>=1;chk--) { if (occ[chk]>0) { if (chk==N/2) { if (N%2==0) mp[i]={N/2,(N/2)+1}; else mp[i]={(N/2)+1,(N/2)+1}; } else mp[i]={N-chk,chk+1}; break; } } } map<int,bool> done; for (int i=1;i<=N;i++) { if (!done[mp[i].first]) { if (mp[i].first==N) swap(mp[i].first,mp[i].second); answer(i,mp[i].first); done[mp[i].first]=true; } else { answer(i,mp[i].second); done[mp[i].second]=true; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...