Submission #26994

#TimeUsernameProblemLanguageResultExecution timeMemory
26994wangyenjenPark (JOI17_park)C++14
10 / 100
193 ms2120 KiB
// Author: Wang, Yen-Jen #include "park.h" #include <bits/stdc++.h> using namespace std; inline void subtask1(int N) { static int place[250]; memset(place , 0 , sizeof(place)); for(int i = 0; i < N; i++) { for(int j = i + 1; j < N; j++) { place[i] = 1; place[j] = 1; if(Ask(i , j , place)) Answer(i , j); place[i] = 0; place[j] = 0; } } } inline void subtask2(int N) { static int place[1400]; for(int i = 0; i < N; i++) place[i] = 1; vector<int> vec; for(int i = 1; i < N - 1; i++) vec.push_back(i); stable_sort(vec.begin() , vec.end() , [&](const int x , const int y) { place[x] = 0; int t = Ask(0 , y , place); place[x] = 1; return t == 0; }); for(int i = 1; i < (int)vec.size(); i++) Answer(vec[i - 1] , vec[i]); Answer(0 , vec[0]); Answer(vec.back() , N - 1); } void Detect(int T , int N) { if(N == 1) return; else if(N == 2) { Answer(0 , 1); return; } if(T == 1) subtask1(N); else if(T == 2) subtask2(N); }
#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...