제출 #407169

#제출 시각아이디문제언어결과실행 시간메모리
407169VictorTriangles (CEOI18_tri)C++17
55 / 100
3098 ms836 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(); 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; }

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

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