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 "park.h"
#include <bits/stdc++.h>
using namespace std;
static int Place[1400];
void strat1(int N) {
for(int i=0;i<N;i++) {
for(int j=i+1;j<N;j++) {
Place[i]=Place[j]=1;
if(Ask(i,j,Place))Answer(i,j);
Place[i]=Place[j]=0;
}
}
}
void strat2(int N) {
vector<int> order = {0,N-1};
for(int i=0;i<N;i++)Place[i]=1;
for(int i=1;i<N-1;i++) {
int pos = 0;
Place[i]=0;
for(int jump=1024;jump;jump/=2) {
if(pos+jump>=order.size())continue;
if(Ask(0,order[pos+jump],Place))pos+=jump;
}
Place[i]=1;
order.emplace(order.begin()+pos+1,i);
}
for(int i=0;i<N;i++)Place[i]=0;
for(int i=1;i<N;i++)Answer(min(order[i],order[i-1]),max(order[i],order[i-1]));
}
void Detect(int T, int N) {
if(T==1)strat1(N);
else if(T==2)strat2(N);
}
Compilation message (stderr)
park.cpp: In function 'void strat2(int)':
park.cpp:24:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | if(pos+jump>=order.size())continue;
| ~~~~~~~~^~~~~~~~~~~~~~
# | 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... |