제출 #610910

#제출 시각아이디문제언어결과실행 시간메모리
610910skittles1412Aliens (IOI16_aliens)C++17
0 / 100
0 ms212 KiB
#include "bits/extc++.h" using namespace std; template <typename T> void dbgh(const T& t) { cerr << t << endl; } template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t << " | "; dbgh(u...); } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__); #else #define dbg(...) #define cerr \ if (false) \ cerr #endif using ll = long long; #define endl "\n" #define long int64_t #define sz(x) int((x).size()) long sq(long x) { return x * x; } ll take_photos(int n, int, int k, vector<int> a1, vector<int> a2) { pair<int, int> arr[n]; for (int i = 0; i < n; i++) { arr[i] = {min(a1[i], a2[i]), max(a1[i], a2[i])}; } sort(arr, arr + n); long dp[n + 1]; dp[n] = 0; for (int i = n - 1; i >= 0; i--) { dp[i] = 1e18; for (int j = i; j < n; j++) { dp[i] = min(dp[i], dp[j + 1] + sq(arr[j].second - arr[i].first + 1)); } } return dp[0]; }
#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...