제출 #440782

#제출 시각아이디문제언어결과실행 시간메모리
440782bonopoCover (COCI18_cover)C++14
120 / 120
98 ms588 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define pb push_back #define el "\n" #define f first #define s second typedef long long ll; const int MM=5e3+5, MOD=1e9+7; ll N, dp[MM]; vector<pair<ll,ll>> pta, ptb; int32_t main() { cin.tie(nullptr)->sync_with_stdio(false); cin>>N; for(int i=1, x, y; i<=N; ++i) { cin>>x>>y; pta.pb({abs(x), abs(y)}); } for(auto &a:pta) { bool g=1; for(auto &b:pta) if(b.f>a.f&&b.s>a.s) g=0; if(g) ptb.pb(a); } sort(begin(ptb), end(ptb)); memset(dp, 0x3f, sizeof(dp)); dp[0]=0; for(int i=0; i<ptb.size(); ++i) { ll c=i+1, mh=0; for(int j=i; j>=0; --j) { mh=max(mh, ptb[j].s); dp[c]=min(dp[c], dp[j]+ptb[i].f*mh); } } cout<<dp[ptb.size()]*4LL<<el; } // MM

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

cover.cpp: In function 'int32_t main()':
cover.cpp:27:19: 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]
   27 |     for(int i=0; i<ptb.size(); ++i) {
      |                  ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...