Submission #116008

#TimeUsernameProblemLanguageResultExecution timeMemory
116008MeloricTriangles (CEOI18_tri)C++14
0 / 100
2 ms384 KiB
#include "trilib.h" #include <bits/stdc++.h> #define pb push_back #define X first #define Y second #define pii pair<int, int> using namespace std; /* int get_n(){ int c; cin >> c; return c; } void give_answer(int a){ cout << a; } bool is_clockwise(int a, int b, int c){ cout << a << ' '<<b <<' '<<c<<endl; bool d; cin >> d; return d; }*/ bool ask(int a, int b, int c){ a++; b++; c++; return is_clockwise(a, b, c); } bool cmp(int a, int b){ return !ask(0, a, b); } int main(){ ios_base::sync_with_stdio(false); int n; n = get_n(); if(n==3)give_answer(3); vector<int> up, dw, srt, hull; for(int i = 2; i < n; i++){ if(ask(0, 1, i))up.pb(i); else dw.pb(i); } sort(up.begin(), up.end(), cmp); sort(dw.begin(), dw.end(), cmp); dw.pb(0), up.pb(1); for(int i : up)srt.pb(i); for(int i : dw)srt.pb(i); for(int i = 0; i < srt.size(); i++){ int sz = hull.size(); while(sz>1 && ask(hull[sz-2], hull[sz-1], srt[i])){ hull.pop_back(); sz--; } hull.pb(srt[i]); } deque<int> dq; for(auto i : hull)dq.pb(i); while(1){ int flag = 1; int cur = dq.back(); dq.pop_back(); if(ask(dq.back(), cur, dq.front())){ flag = 0; }else dq.pb(cur); cur = dq.front(); dq.pop_front(); if(ask(dq.back(), cur, dq.front())){ flag = 0; }else dq.push_front(cur); if(flag)break; } give_answer(dq.size()); return 0; }

Compilation message (stderr)

tri.cpp: In function 'int main()':
tri.cpp:43:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < srt.size(); i++){
                    ~~^~~~~~~~~~~~
#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...