Submission #965910

#TimeUsernameProblemLanguageResultExecution timeMemory
965910vjudge1Aliens (IOI16_aliens)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long i64; typedef pair<int, int> pii; #define ff first #define ss second #define MP make_pair const int mxk = 220; const int mxn = 1010; const i64 inf = 1e18; int a[mxn], p[mxn], n, k; i64 dp[mxn][mxk], ls[mxn][mxk]; i64 kv(i64 a) { return a * a; } void solve() { cin >> n >> k; for(int i = 0; i <= n; i++) for(int j = 0; j <= k; j++) dp[i][j] = inf; for(int i = 1; i <= n; i++) { cin >> a[i]; p[i] = p[i - 1] + a[i]; dp[i][0] = kv(p[i]); } for(int i = 2; i <= n; i++) for(int j = 1; j <= k; j++) { for(int q = 1; q < i; q++) if(dp[i][j] > dp[q][j - 1] + kv(p[i] - p[q])) { dp[i][j] = dp[q][j - 1] + kv(p[i] - p[q]); ls[i][j] = q; } } cout << (kv(p[n]) - dp[n][k]) / 2 << endl; int last = ls[n][k]; for(int i = k - 1; i >= 0; i--) { cout << last << ' '; last = ls[last][i]; } } signed main() { #ifdef LOCAL auto start = chrono::high_resolution_clock::now(); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); signed t = 1; // cin >> t; while(t--) solve(); #ifdef LOCAL auto end = chrono::high_resolution_clock::now(); cout << "\n"; for(int i = 0; i <= 20; ++i) cout << '-'; cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl; #endif return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccTmz9EK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccsirEJK.o:aliens.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccTmz9EK.o: in function `main':
grader.cpp:(.text.startup+0xf0): 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