Submission #405428

#TimeUsernameProblemLanguageResultExecution timeMemory
405428ollelTriangles (CEOI18_tri)C++14
55 / 100
1490 ms960 KiB
#include <bits/stdc++.h> #include <iostream> #include "trilib.h" using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back int n; bool hull(int a, int b) { rep(c, 1, n + 1) { if (c == a || c == b) continue; if (!is_clockwise(a, b, c)) return false; } return true; } int find_neighbor(int a) { //a down, b up int b = (a != 1) ? 1:2; rep(c, 1, n+1) { if (c == a || c == b) continue; if (is_clockwise(a, c, b)) b = c; } return b; } int main() { n = get_n(); set<int> h; rep(i, 1, n + 1) { int j = find_neighbor(i); if (hull(i, j) || hull(j, i)) {h.insert(i); h.insert(j);} } cout << h.size() << endl; }
#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...