Submission #26453

#TimeUsernameProblemLanguageResultExecution timeMemory
26453pacuPark (JOI17_park)C++98
20 / 100
213 ms2160 KiB
#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); } int question(int a,int b,int p[]) { if(a>b) swap(a,b); return Ask(a,b,p); } 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(question(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); } }

Compilation message (stderr)

park.cpp: In function 'void solveRange(int, int, std::vector<int>)':
park.cpp:42: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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...