Submission #79636

#TimeUsernameProblemLanguageResultExecution timeMemory
79636LeMansAliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include "aliens.h" #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 = 5005; const int M = 1000500; ll dp[N][N]; int sz, ar[N], pref[N], pos[N], f[M]; ll take_photos(int n, int m, int lim, int[] r, int[] c) { for (int i = 0; i < n; 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); } sort(ar + 1, ar + 1 + sz); sz = unique(ar + 1, ar + 1 + sz) - ar - 1; 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 j = 1; j <= lim; j++) { for (int k = 1; k <= i; k++) { int mustpos = pos[k - 1]; if (mustpos > i) continue; ll trash = (mustpos >= k ? sqr(ar[mustpos] - ar[k] + 1) : 0); dp[i][j] = min(dp[i][j], dp[mustpos][j - 1] + sqr(ar[i] - ar[k] + 1) - trash); } } } ll ans = inf; for (int i = 1; i <= lim; i++) ans = min(ans, dp[sz][i]); return ans; }

Compilation message (stderr)

aliens.cpp:60:45: error: expected ',' or '...' before 'r'
 ll take_photos(int n, int m, int lim, int[] r, int[] c) {
                                             ^
aliens.cpp: In function 'll take_photos(int, int, int, int*)':
aliens.cpp:62:15: error: 'r' was not declared in this scope
   int L = min(r[i], c[i]);
               ^
aliens.cpp:62:21: error: 'c' was not declared in this scope
   int L = min(r[i], c[i]);
                     ^