제출 #599363

#제출 시각아이디문제언어결과실행 시간메모리
599363gromperenAliens (IOI16_aliens)C++14
12 / 100
117 ms1300 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) { 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; }

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

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:41:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  for (int i = 1; i <= cords.size(); ++i) {
      |                  ~~^~~~~~~~~~~~~~~
#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...