제출 #961723

#제출 시각아이디문제언어결과실행 시간메모리
961723Ahmed57Aliens (IOI16_aliens)C++17
0 / 100
1 ms376 KiB
#include <bits/stdc++.h> #include "aliens.h" using namespace std; long long take_photos(int n, int m, int k, vector<int> r,vector<int> c){ vector<pair<long long,long long>> seg1,seg; for(int i = 0;i<n;i++){ seg1.push_back({min(c[i],r[i]),max(c[i],r[i])}); } long long ma = -1e18; for(int i = 0;i<n;i++){ if(seg1[i].second>ma){ seg.push_back(seg1[i]); ma = seg1[i].second; } } long long dp[seg.size()+1][k+1]; for(int i = 0;i<=k;i++)dp[0][i] = 0; for(int i = 1;i<=seg.size();i++){ dp[i][0] = 1e18; for(int j = 1;j<=k;j++){ dp[i][j] = 1e18; for(int e = 0;e<i;e++){ dp[i][j] = min(dp[i][j],dp[e][j-1]+(seg[i-1].second-seg[e].first+1)*(seg[i-1].second-seg[e].first+1)-(e==0?0:max(0ll,seg[e-1].second-seg[e].first+1)*max(0ll,seg[e-1].second-seg[e].first+1))); } } } return dp[seg.size()][k]; }

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

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