제출 #599367

#제출 시각아이디문제언어결과실행 시간메모리
599367gromperenAliens (IOI16_aliens)C++14
4 / 100
1 ms344 KiB
#include <bits/stdc++.h> #include "aliens.h" const int INF = 1e9+7; using namespace std; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { vector<vector<int>> vis(m+1, vector<int>(m+1)); int ans = 0; for (int i = 0; i < n; ++i) { if (r[i] > c[i]) swap(r[i], c[i]); for (int x = r[i]; x <= c[i]; ++x) { for (int y = r[i]; y <= c[i]; ++y) { if (vis[x][y]) continue; ans++; vis[x][y] = 1; } } } /* vector<pair<int,int>> tmpcords; vector<pair<int,int>> cords; for (int i = 0; i < n; ++i) { tmpcords.push_back({r[i], c[i]}); } sort(tmpcords.begin(), tmpcords.end()); for (int i = 0; i < n; ++i) { if (i > 0 && tmpcords[i].first == cords[i-1].first && tmpcords[i].second == cords[i-1].second) continue; cords.push_back(tmpcords[i]); } vector<vector<int>> dp(n+1, vector<int>(k+1, INF)); n = cords.size(); dp[0][0] = 0; //for (int i = 0; i < cords.size(); ++i) { //dp[0][i] = 0; //} for (int i = 1; i <= cords.size(); ++i) { for (int j =1; j <= k; ++j) { for (int p = 0; p < i; ++p) { dp[i][j] = min(dp[i][j], dp[p][j-1] + (cords[i-1].first - cords[p].first + 1) * (cords[i-1].second - cords[p].first + 1)); } } } int ans = 1e9+7; for (int i = 0; i <= k; ++i) { ans = min(ans, dp[cords.size()][i]); } */ return ans; }
#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...