Submission #407379

#TimeUsernameProblemLanguageResultExecution timeMemory
407379VictorTriangles (CEOI18_tri)C++17
0 / 100
1 ms320 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; int n = get_n(); vi cities; rep(i, 2, n + 1) { int lo = 0, hi = sz(cities); while (lo != hi) { int mid = (lo + hi) >> 1; if (is_clockwise(1, cities[mid], i)) hi = mid; else lo = mid + 1; } cities.insert(cities.begin() + lo, i); } stack<int> s; s.push(1); s.push(cities[0]); cities.pb(1); rep(i, 1, sz(cities)) { int b = s.top(), c = cities[i]; s.pop(); int a = s.top(); if (!is_clockwise(a, b, c)) s.push(b); s.push(c); } s.pop(); vi hull; while (!s.empty()) { hull.pb(s.top()); s.pop(); } hull.pop_back(); if (is_clockwise(hull.back(), 1, hull[0])) hull.pb(1); /* reverse(all(hull)); trav(city, hull) cout << city << ' '; cout << endl;*/ give_answer(sz(hull)); return 0; }

Compilation message (stderr)

tri.cpp: In function 'int main()':
tri.cpp:7:40: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define rep(i, a, b) for (int i = a; i < (b); ++i)
      |                                        ^
tri.cpp:52:5: note: in expansion of macro 'rep'
   52 |     rep(i, 1, 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...