제출 #383529

#제출 시각아이디문제언어결과실행 시간메모리
383529maximath_1Triangles (CEOI18_tri)C++11
0 / 100
1 ms492 KiB
#include "trilib.h" #include <iostream> #include <assert.h> #include <vector> #include <string> #include <algorithm> #include <numeric> #include <deque> using namespace std; void getConvexHull(){ int n = get_n(); vector<int> v[2]; deque<int> ch; v[0].push_back(1); v[0].push_back(2); for(int i = 3; i <= n; i ++) v[is_clockwise(1, 2, i)].push_back(i); for(int tp = 0; tp < 2; tp ++){ sort(v[tp].begin() + (tp == 0), v[tp].end(), [&](int a, int b){ return is_clockwise(1, a, b); }); for(int i = 0; i < v[tp].size(); i ++){ while(ch.size() >= 2 && !is_clockwise(ch[ch.size() - 2], ch.back(), v[tp][i])) ch.pop_back(); ch.push_back(v[tp][i]); } } for(bool done = 0; !done;){ done = 1; if(ch.size() >= 2 && !is_clockwise(ch[ch.size() - 2], ch.back(), ch.front())){ ch.pop_back(); done = 0; continue; } if(ch.size() >= 2 && !is_clockwise(ch.back(), ch[0], ch.front())){ ch.pop_front(); done = 0; continue; } } give_answer(ch.size()); } int main(){ getConvexHull(); }

컴파일 시 표준 에러 (stderr) 메시지

tri.cpp: In function 'void getConvexHull()':
tri.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for(int i = 0; i < v[tp].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...