Submission #285480

#TimeUsernameProblemLanguageResultExecution timeMemory
285480HynDufMountains (IOI17_mountains)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define task "M" #define all(v) (v).begin(), (v).end() #define rep(i, l, r) for (int i = (l); i <= (r); ++i) #define Rep(i, r, l) for (int i = (r); i >= (l); --i) #define DB(X) { cerr << #X << " = " << (X) << '\n'; } #define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; } #define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; } #define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; } #define PR(A, l, r) { cerr << '\n'; rep(_, l, r) DB1(A, _); cerr << '\n';} #define SZ(x) ((int)(x).size()) #define pb push_back #define eb emplace_back #define pf push_front #define F first #define S second #define by(x) [](const auto& a, const auto& b) { return a.x < b.x; } // sort(arr, arr + N, by(a)); #define next ___next #define prev ___prev #define y1 ___y1 #define left ___left #define right ___right #define y0 ___y0 #define div ___div #define j0 ___j0 #define jn ___jn using ll = long long; using ld = long double; using ull = unsigned long long; using namespace std; typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vl; const int N = 2003; int dp[N][N]; bool can_reach(ii &A, ii &B, ii &C) // Line AC is not cut by B - A->B->C must go in counter clockwise order (A.x < B.x < C.x) { return ((B.F - A.F) * (C.S - A.S) - (C.F - A.F) * (B.S - A.S)) >= 0; } int maximum_deevs(vi a) { int n = SZ(a); vii aa; rep(i, 0, n - 1) aa.eb(i, a[i]); rep(r, 0, n - 1) { int lst = r, sum = 0; // the minimum index in [l, r] that lst can see r, .i.e. lst and r cannot be chose together dp[r][r] = 1; Rep(l, r - 1, 0) { if (can_reach(aa[l], aa[lst], aa[r])) { sum += dp[l + 1][lst - 1]; lst = l; } dp[l][r] = max(dp[l][r], 1 + sum + dp[l][lst - 1]); } } return dp[0][n - 1]; } int main() { #ifdef HynDuf freopen(task".in", "r", stdin); //freopen(task".out", "w", stdout); #else ios_base::sync_with_stdio(false); cin.tie(nullptr); #endif int n; vi a; cin >> n; rep(i, 1, n) { int x; cin >> x; a.eb(x); } cout << maximum_deevs(a); return 0; }

Compilation message (stderr)

/tmp/cc0Qq3Ci.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc1fM6T4.o:mountains.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status