제출 #121399

#제출 시각아이디문제언어결과실행 시간메모리
121399BTheroTriangles (CEOI18_tri)C++17
컴파일 에러
0 ms0 KiB
// Why am I so dumb? :c // chrono::system_clock::now().time_since_epoch().count() //#pragma GCC optimize("Ofast") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #include<bits/stdc++.h> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include"trilib.h" #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second using namespace std; using namespace __gnu_pbds; typedef long long ll; template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int MAXN = (int)4e4 + 5; vector<int> A, B, V; int idx[MAXN]; bool cmp(int a, int b) { return is_clockwise(n, a, b); } void solve() { int n = get_n(); int pivot = 1; for (int i = 2; i < n; ++i) { if (is_clockwise(n, i, pivot)) { A.pb(i); } else { B.pb(i); } } sort(all(A), cmp); sort(all(B), cmp); int tmp = 0; for (int x : A) { idx[++tmp] = x; } idx[++tmp] = pivot; for (int x : B) { idx[++tmp] = x; } V.pb(n); V.pb(idx[1]); tmp = 2; for (int i = 2; i <= n - 1; ++i) { while (tmp >= 2 && !is_clockwise(V[tmp - 2], V.back(), idx[i])) { V.pop_back(); --tmp; } V.pb(idx[i]); ++tmp; } while (V.size() > 3 && !is_clockwise(V.back(), V.front(), V[1])) { V.erase(V.begin()); } while (V.size() > 3 && !is_clockwise(V[V.size() - 2], V.back(), V.front())) { V.pop_back(); } give_answer(V.size()); } int main() { int tt = 1; while (tt--) { solve(); } return 0; }

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

tri.cpp: In function 'bool cmp(int, int)':
tri.cpp:33:25: error: 'n' was not declared in this scope
     return is_clockwise(n, a, b);
                         ^