This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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]) {
answer(i,mp[i].first);
done[mp[i].first]=true;
}
else {
answer(i,mp[i].second);
done[mp[i].second]=true;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |