Submission #124842

#TimeUsernameProblemLanguageResultExecution timeMemory
124842nvmdavaAliens (IOI16_aliens)C++17
Compilation error
0 ms0 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]; } int main() { int n, m, k; scanf("%d %d %d", &n, &m, &k); std::vector<int> r(n), c(n); for (int i = 0; i < n; i++) { scanf("%d %d", &r[i], &c[i]); } long long ans = take_photos(n, m, k, r, c); printf("%lld\n", ans); return 0; }

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;
  ^~~
aliens.cpp: In function 'int main()':
aliens.cpp:43:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d", &n, &m, &k);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
aliens.cpp:46:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &r[i], &c[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
/tmp/ccQIMK0l.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccPy3J5C.o:aliens.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status