제출 #898143

#제출 시각아이디문제언어결과실행 시간메모리
898143math_rabbit_1028Triangles (CEOI18_tri)C++14
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> #include "trilib.h" using namespace std; int n, origin; vector<int> arr; bool compare(int i, int j) { return is_clockwise(i, origin, j); } void solve() { n = get_n(); int k = 1, l = 2, t = 0; while (++t) { bool f = false; for (int i = 1; i <= n; i++) { if (i != k && i != l) { if (is_clockwise(k, l, i)) { f = true; if (t % 2 == 1) k = i; else l = i; break; } } } if (!f) break; } origin = k; for (int i = 1; i <= n; i++) if (i != origin) arr.push_back(i); sort(arr.begin(), arr.end(), compare); stack<int> stk; stk.push(origin); stk.push(arr[0]); for (int i = 1; i < arr.size(); i++) { int a = stk.top(); stk.pop(); while (stk.size() >= 2 && !is_clockwise(stk.top(), a, arr[i])) { stk.top() = a; stk.pop(); } stk.push(a); stk.push(arr[i]); } give_answer(stk.size()); } int main() { solve(); }

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

tri.cpp: In function 'void solve()':
tri.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for (int i = 1; i < arr.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...