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 <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
typedef long long llo;
#define endl '\n'
#include "island.h"
int it[301];
int co[301];
int ans[301];
int ind[301];
void solve(int n, int L) {
vector<int> ss;
ind[1]=0;
for(int i=1;i<=n-1;i++){
ss.pb(query(1,i));
//it[i]=query(1,i);
//ans[i]=-1;
ind[ss.back()]=ss.size();
}
for(int i=1;i<=n;i++){
ans[i]=-1;
}
for(auto j:ss){
if(ans[j]!=-1){
continue;
}
for(int k=1;k<=n-1;k++){
int x=query(j,k);
if(ind[x]<ind[j]){
ans[j]=x;
break;
}
ans[x]=j;
}
}
for(int i=2;i<=n;i++){
//cout<<i<<",,"<<ans[i]<<endl;
answer(ans[i],i);
}
/* int variable_example = query(1, 1);
for (int i = 2; i <= N; i++) {
answer(1, i);
}*/
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |