이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "park.h"
#include <cstdlib>
#include <vector>
using namespace std;
static int place[1400];
int nNodes;
void clear()
{
for(int j=0;j<nNodes;j++)
place[j] = 0;
}
void fill()
{
for(int j=0;j<nNodes;j++)
place[j] = 1;
}
void ansEdge(int a,int b)
{
if(a>b) swap(a,b);
Answer(a,b);
}
void solveRange(int l,int r,vector<int> lst)
{
if(lst.size()==0)
{
ansEdge(l,r);
return;
}
int mid = lst[rand()%lst.size()];
vector<int> lList,rList;
for(int j=0;j<lst.size();j++) if(lst[j]!=mid)
{
fill();
place[lst[j]] = 0;
if(Ask(l,mid,place)) rList.push_back(lst[j]);
else lList.push_back(lst[j]);
}
solveRange(l,mid,lList);
solveRange(mid,r,rList);
}
void Detect(int T,int N)
{
nNodes = N;
if(T==1)
{
for(int i=0;i<N;i++)
for(int j=i+1;j<N;j++)
{
clear();
place[i] = place[j] = 1;
if(Ask(i,j,place))
ansEdge(i,j);
}
}
if(T==2)
{
vector<int> lst;
for(int i=1;i<N-1;i++)
lst.push_back(i);
solveRange(0,N-1,lst);
}
}
컴파일 시 표준 에러 (stderr) 메시지
park.cpp: In function 'void solveRange(int, int, std::vector<int>)':
park.cpp:36:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j=0;j<lst.size();j++) if(lst[j]!=mid)
^
# | 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... |