제출 #409915

#제출 시각아이디문제언어결과실행 시간메모리
409915VictorTriangles (CEOI18_tri)C++17
100 / 100
152 ms1624 KiB
#include <bits/stdc++.h> #include "trilib.h" using namespace std; #define rep(i, a, b) for (int i = a; i < (b); ++i) #define per(i, a, b) for (int i = b - 1; i >= (a); --i) #define trav(a, x) for (auto &a : x) #define all(x) x.begin(), x.end() #define sz(x) x.size() #define pb push_back #define umap unordered_map #define uset unordered_set typedef pair<int, int> ii; typedef pair<int, ii> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<vi> vvi; typedef long long ll; const int INF = 1000000007; int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); bitset<40001> taken; const int n = get_n(); int start = random() % n + 1, q = 1, ans = 0; vi cities, hull; bool stop = 0; int x = 10; rep(i, 1, n + 1) cities.pb(i); while (x--) { vi sorted; trav(city, cities) { int lo = 0, hi = sz(sorted); if (city == start) continue; while (lo != hi) { if (1'000'000 == q++) { stop = 1; break; } int mid = (lo + hi) >> 1; if (is_clockwise(start, sorted[mid], city)) hi = mid; else lo = mid + 1; } if (stop) break; sorted.insert(sorted.begin() + lo, city); } if (stop) break; cities.swap(sorted); int i = 1; hull.pb(start); hull.pb(cities[0]); while (i < sz(cities)) { int j = sz(hull) - 1; if (1'000'000 == q++) { stop = 1; break; } if (is_clockwise(hull[j - 1], hull[j], cities[i])) hull.pop_back(); else hull.pb(cities[i++]); } if (stop) break; ans = sz(hull); start = hull[random() % ans]; cities.swap(hull); hull.clear(); } give_answer(ans); return 0; }

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

tri.cpp: In function 'int main()':
tri.cpp:70:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   70 |         while (i < sz(cities)) {
      |                  ^
#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...