Submission #403832

#TimeUsernameProblemLanguageResultExecution timeMemory
403832VictorTriangles (CEOI18_tri)C++17
15 / 100
3 ms348 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); int city; int n=get_n(); if (50 < n) return 0; int arr[n][n][n], nxt[n]; rep(i, 0, n) { rep(j, 0, n) { if (i == j) continue; bool skip = 0; rep(k, 0, n) { if (i == k || j == k) continue; skip |= is_clockwise(i + 1, k + 1, j + 1); } if (!skip) { city=i; nxt[i] = j; break; } } } int layer[n], cur = 0; memset(layer, -1, n * 4); while (1) { if (layer[city] != -1) { give_answer(cur - layer[city]); break; } layer[city] = cur++; city = nxt[city]; } return 0; }

Compilation message (stderr)

tri.cpp: In function 'int main()':
tri.cpp:34:9: warning: unused variable 'arr' [-Wunused-variable]
   34 |     int arr[n][n][n], nxt[n];
      |         ^~~
tri.cpp:57:23: warning: 'city' may be used uninitialized in this function [-Wmaybe-uninitialized]
   57 |         if (layer[city] != -1) {
      |             ~~~~~~~~~~^
#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...