Submission #130554

#TimeUsernameProblemLanguageResultExecution timeMemory
130554Bench0310Triangles (CEOI18_tri)C++17
0 / 100
4 ms376 KiB
#include <bits/stdc++.h> #include "trilib.h" using namespace std; /*int get_n() { return 6; } bool is_clockwise(int a,int b,int c) { cout << "query: " << a << " " << b << " " << c << endl; int res; cin >> res; return res; } void give_answer(int s) { cout << "answer: " << s << endl; exit(0); }*/ int main() { int n=get_n(); vector<int> l,r; for(int i=3;i<=n;i++) { if(is_clockwise(1,2,i)) r.push_back(i); else l.push_back(i); } sort(l.begin(),l.end(),[](int a,int b){return is_clockwise(1,a,b);}); sort(r.begin(),r.end(),[](int a,int b){return is_clockwise(1,a,b);}); reverse(l.begin(),l.end()); vector<int> one={1,2}; for(int a:l) { one.push_back(a); while(one.size()>=3&&is_clockwise(one[one.size()-3],one[one.size()-2],one.back())) one.pop_back(); } vector<int> two={1,2}; for(int a:r) { two.push_back(a); while(two.size()>=3&&is_clockwise(two[two.size()-3],two[two.size()-2],two.back())==0) two.pop_back(); } int res=one.size()+two.size()-2; if(min(one.size(),two.size())>=3&&is_clockwise(2,one[2],two[2])) res--; if(min(one.size(),two.size())>=3&&is_clockwise(1,one.back(),two.back())==0) res--; give_answer(res); return 0; }
#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...