Submission #712656

#TimeUsernameProblemLanguageResultExecution timeMemory
712656minhnhatnoeAliens (IOI16_aliens)C++17
0 / 100
1 ms340 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll sq(ll a) {return a * a;} ll take_photos(int n, int m, int k, vector<int> r, vector<int> c){ sort(r.begin(), r.end()); vector<ll> dp1(n, 1e15), dp2(n); while (k--){ for (int i=0; i<n; i++){ dp2[i] = dp1[i]; for (int j=0; j<=i; j++){ dp2[i] = min(dp2[i], (j ? dp1[j-1] : 0) + sq(r[i] - r[j] + 1)); } } swap(dp1, dp2); } cout << dp2.back() << "\n"; }

Compilation message (stderr)

aliens.cpp: In function 'll take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...