Submission #124843

#TimeUsernameProblemLanguageResultExecution timeMemory
124843nvmdavaAliens (IOI16_aliens)C++17
12 / 100
102 ms6392 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; int temp[1000005]; vector<pair<int, int> > v; long long dp[505][505]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { memset(temp, -1, sizeof temp); for(int i = 0; i < n; i++) temp[min(c[i], r[i])] = 1 + max(r[i], c[i]); int mx = -1; v.push_back({-1, -1}); for(int i = 0; i < m; i++) if(temp[i] > mx) v.push_back({i, mx = temp[i]}); n = v.size() - 1; k = min(k, n); memset(dp, 0x3f3f, sizeof dp); dp[0][0] = 0; for(int i = 1; i <= k; i++){ for(int j = 1; j <= n; j++){ for(int l = 0; l < j; l++){ dp[i][j] = min(dp[i][j], dp[i - 1][l] + (v[j].second - v[l + 1].first) * (v[j].second - v[l + 1].first)); } } } return dp[k][n]; }

Compilation message (stderr)

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:14:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(int i = 0; i < n; i++)
     ^~~
aliens.cpp:17:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  int mx = -1;
  ^~~
#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...