Submission #116016

#TimeUsernameProblemLanguageResultExecution timeMemory
116016MeloricTriangles (CEOI18_tri)C++14
0 / 100
3 ms640 KiB
#include <bits/stdc++.h> #include "trilib.h" #define pb push_back #define X first #define Y second #define pii pair<int, int> using namespace std; bool ask(int a, int b, int c){ a++; b++; c++; return is_clockwise(a, b, c); } bool cmp(int a, int b){ if(a==b)return 0; 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, hull; dw.pb(1); 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.insert(dw.begin(), 0); for(int i = 0; i < dw.size(); i++){ while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], dw[i]))hull.pop_back(); hull.pb(dw[i]); } for(int i = 0; i < up.size(); i++){ while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], up[i]))hull.pop_back(); hull.pb(up[i]); } int sz = hull.size(); for(int i = 0; i < dw.size(); i++){ while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], dw[i]))hull.pop_back(); hull.pb(dw[i]); } for(int i = 0; i < up.size(); i++){ while(hull.size()>1 && ask(hull.end()[-2], hull.end()[-1], up[i]))hull.pop_back(); hull.pb(up[i]); } give_answer(hull.size()-sz); return 0; }

Compilation message (stderr)

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