제출 #889713

#제출 시각아이디문제언어결과실행 시간메모리
889713Ghulam_JunaidAliens (IOI16_aliens)C++17
4 / 100
1 ms604 KiB
#include <bits/stdc++.h> // #include "grader.cpp" using namespace std; typedef long long ll; const int N = 4005; const int inf = 1e9; bool vis[N][N]; ll dp[N][N]; ll take_photos(int n, int m, int k, vector<int> r, vector<int> c){ if (n == k){ ll ans = 0; int last = 0; for (int i = 0; i < m; i++){ // we are at (i, i); int len = 0; for (int j = 0; j < n; j++){ if (vis[r[j]][c[j]]) continue; if (r[j] == i) len = max(len, c[j] - i + 1); if (c[j] == i) len = max(len, r[j] - i + 1); } for (int x = i; x < i + len; x++){ for (int y = i; y < i + len; y++){ vis[x][y] = 1; } } } for (int i=0; i<m; i++) for (int j=0; j<m; j++) ans += vis[i][j]; return ans; } for (int i=0; i<m; i++) for (int j=0; j<=k; j++) dp[i][j] = inf; for (int i = m - 1; i >= 0; i--){ int mx = -1; for (int j = 0; j < n; j++) if (r[j] >= i) mx = max(mx, r[j]); for (int j = 0; j <= k; j++){ if (mx < i){ dp[i][j] = 0; continue; } if (j == 0) continue; for (int ip = i + 1; ip <= m; ip++){ dp[i][j] = min(dp[i][j], (ip - i) * (ip - i) + dp[ip][j - 1]); } } for (int j = 1; j <= k; j++) dp[i][j] = min(dp[i][j], dp[i][j - 1]); } return (ll)dp[0][k]; }

컴파일 시 표준 에러 (stderr) 메시지

aliens.cpp: In function 'll take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:16:13: warning: unused variable 'last' [-Wunused-variable]
   16 |         int last = 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...