Submission #79647

#TimeUsernameProblemLanguageResultExecution timeMemory
79647LeMansAliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include <stdio.h> #include <bits/stdc++.h> using namespace std; typedef double db; typedef long long ll; typedef long double ld; typedef unsigned int ui; typedef unsigned long long ull; typedef pair < db, db > pdd; typedef pair < db, ld > pdl; typedef pair < ld, db > pld; typedef pair < ld, ld > ldp; typedef pair < ll, ll > pll; typedef pair < int, ll > pil; typedef pair < ll, int > pli; typedef pair < int, int > pii; #define F first #define S second #define en end() #define bg begin() #define rev reverse #define mp make_pair #define pb push_back #define y1 y1234567890 #define um unordered_map #define all(x) x.bg, x.en #define sz(x) (int)x.size() #define len(x) (int)strlen(x) #define sqr(x) ((x + 0ll) * (x)) #define sqrd(x) ((x + 0.0) * (x)) #define forn(i, n) for (int i = 1; i <= n; i++) const ll inf = (ll)1e18; const ll mod = (ll)1e9 + 7; const db eps = (db)1e-9; const db pi = acos(-1.0); const int dx[] = {0, 0, 1, 0, -1}; const int dy[] = {0, 1, 0, -1, 0}; const int N = 10005; const int M = 1000500; ll dp[N][N]; int n, m, lim, sz, r[N], c[N], ar[N], pref[N], pos[N], f[M], p[N][N]; void rec(int l, int r, int optL, int optR, int j) { int mid = (l + r) >> 1; for (int k = optL; k <= min(mid, optR); k++) { int mustpos = pos[k - 1]; if (mustpos > mid) continue; ll trash = (mustpos >= k ? sqr(ar[mustpos] - ar[k] + 1) : 0); if (dp[mustpos][j - 1] + sqr(ar[mid] - ar[k] + 1) - trash < dp[mid][j]) { dp[mid][j] = dp[mustpos][j - 1] + sqr(ar[mid] - ar[k] + 1) - trash; p[mid][j] = k; } } if (l != r) { rec(l, mid, optL, p[mid][j], j); rec(mid + 1, r, p[mid][j], optR, j); } } int main() { //freopen(".in", "r", stdin); //freopen(".out", "w", stdout); //freopen(".err", "w", stderr); //srand(time(NULL)); //cin.tie(NULL); //cout.tie(NULL); //ios_base::sync_with_stdio(false); //cout << setprecision(10) << fixed; cin >> n >> m >> lim; for (int i = 0; i < n; i++) { cin >> r[i] >> c[i]; int L = min(r[i], c[i]); int R = max(r[i], c[i]); L++, R++; ar[++sz] = L; ar[++sz] = R; f[L] = max(f[L], R); //cerr << i << " : " << L << " " << R << endl; } sort(ar + 1, ar + 1 + sz); sz = unique(ar + 1, ar + 1 + sz) - ar - 1; /*cerr << endl; for (int i = 1; i <= sz; i++) cerr << ar[i] << " "; cerr << endl;*/ for (int i = 0; i <= sz; i++) for (int j = 0; j <= lim; j++) dp[i][j] = inf; dp[0][0] = 0; for (int i = 1; i <= sz; i++) { pref[i] = max(pref[i - 1], f[ar[i]]); if (pref[i]) pos[i] = lower_bound(ar + 1, ar + 1 + sz, pref[i]) - ar; } for (int i = 1; i <= lim; i++) rec(1, sz, 1, sz, i); ll ans = inf; for (int i = 1; i <= lim; i++) ans = min(ans, dp[sz][i]); cout << ans; //cerr << (clock() + 0.0) / CLOCKS_PER_SEC; return 0; }

Compilation message (stderr)

/tmp/ccs05gk8.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccWpF80r.o:aliens.cpp:(.text.startup+0x0): first defined here
/tmp/ccs05gk8.o: In function `main':
grader.cpp:(.text.startup+0xdf): undefined reference to `take_photos(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status