Submission #760143

#TimeUsernameProblemLanguageResultExecution timeMemory
760143AryanReddyAliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#undef local #include <bits/stdc++.h> #define all(v) v.begin(),v.end() #define allr(v) v.rbegin(),v.rend() #define fori(i,n) for(int i=0;i<n;i++) #define ford(i,n) for(int i = n-1;i >= 0;i--) #define pb push_back #define ll long long int //#define mod 998244353 #define pi pair<int,int> #define pll pair<ll,ll> #define mp make_pair #define fi first #define se second #define printVector(v) fori(;,v.size()) {cout << v[i] << " ";} cout << "\n"; #pragma GCC optimize("O3") std::mt19937 rng((unsigned int) std::chrono::steady_clock::now().time_since_epoch().count()); using namespace std; ll getAns(vector<ll> a,ll k){ int n = a.size(); vector<vector<ll>> dp(n+1,vector<ll> (k+1,1e18)); dp[0][0] = 0; for(int i = 1;i <= n;i++){ for(int j= k;j >= 1;j--){ dp[i][j] = dp[i][j-1]; for(int t = i;t >= 1;t--){ ll d = a[i-1] - a[t-1] + 1; d *= d; dp[i][j] = min(dp[i][j],dp[t-1][j-1] + d); } } } return dp[n][k]; } void solve(){ int n,m,k; cin >> n >> m >> k; vector<ll> a; for(int i = 0;i < n;i++){ int x,y; cin >> x >> y; a.push_back(x); a.push_back(y); } sort(all(a)); a.erase(unique(all(a)),a.end()); ll ans = getAns(a,k); cout << ans << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(0); int t=1; //cin >>t; while(t--) solve(); }

Compilation message (stderr)

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