제출 #403818

#제출 시각아이디문제언어결과실행 시간메모리
403818VictorTriangles (CEOI18_tri)C++17
0 / 100
2 ms460 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; vi fibs; int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int n=get_n(); if (50 < n) return 0; int arr[n][n][n]; rep(i, 0, n) rep(j, 0, n) { if (i == j) continue; rep(k, 0, n) { if (i == k || j == k) continue; arr[i][j][k] = is_clockwise(i + 1, j + 1, k + 1); } } int city = 0, layer[n], cur = 0; memset(layer, -1, n * 4); while (1) { if (layer[city] != -1) { give_answer(cur - layer[city]); break; } layer[city] = cur++; int nxt = -1; rep(j, 0, n) { rep(k, 0, n) { if (j == city || k == city || j == k) continue; if (!arr[city][j][k]) { nxt = j; break; } } if (nxt != -1) break; } int cnt=0; bool stop = 0; while (!stop) { ++cnt; assert(cnt<=n); stop = 1; rep(k, 0, n) { if (k == city || k == nxt) continue; if (!arr[city][k][nxt]) { nxt = k; stop=0; break; } } } city = nxt; } return 0; }
#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...