이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |