Submission #407177

#TimeUsernameProblemLanguageResultExecution timeMemory
407177VictorTriangles (CEOI18_tri)C++17
55 / 100
5 ms972 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<501> taken; int city; int n = get_n(); assert(n<=500); rep(i, 1, n + 1) { int nxt = i == 1 ? 2 : 1; rep(j, 1, n + 1) { if (i == j || j == nxt) continue; if (is_clockwise(i, nxt, j)) nxt = j; } bool onborder = true; rep(j, 1, n + 1) { if (i == j || j == nxt) continue; if (is_clockwise(i, nxt, j)) onborder = false; } if (onborder) { city = nxt; taken[i] = 1; } } while (!taken[city]) { taken[city] = 1; int nxt = city == 1 ? 2 : 1; rep(j, 1, n + 1) { if (city == j || j == nxt) continue; if (is_clockwise(city, nxt, j)) nxt = j; } city=nxt; } cout << taken.count() << endl; return 0; }

Compilation message (stderr)

tri.cpp: In function 'int main()':
tri.cpp:33:9: warning: 'city' may be used uninitialized in this function [-Wmaybe-uninitialized]
   33 |     int city;
      |         ^~~~
#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...