제출 #968470

#제출 시각아이디문제언어결과실행 시간메모리
968470amine_arouaAliens (IOI16_aliens)C++17
25 / 100
2065 ms22364 KiB
#pragma once #include <bits/stdc++.h> using namespace std; #define fore(i , n) for(int i = 0;i<n;i++) #define forr(i , x , y) for(int i = x;i<=y;i++) #define ll long long #define pb push_back const ll INF = 1e18; bool cmp(const pair<ll , ll> &a , const pair<ll , ll> &b) { if(a.first == b.first) { return a.second > b.second; } return (a.first < b.first); } long long take_photos(int n, int m, int g, std::vector<int> r, std::vector<int> c) { vector<pair<ll ,ll>> range; range.pb({-1 ,-1}); fore(i ,n) { range.pb({min(r[i] , c[i]) , max(r[i] , c[i])}); } sort(range.begin() , range.end()); range.erase(unique(range.begin() , range.end()) , range.end()); pair<ll , ll> last = range[1]; vector<pair<ll,ll>> ranges; ranges.pb({-1 ,-1}); ranges.pb(range[1]); forr(i , 2 , (int)range.size() - 1) { if(range[i].second > last.second) { ranges.pb(range[i]); last = range[i]; } } int N = (int)ranges.size() - 1; g = min(g , N); ll dp[N + 1][g + 1]; fore(i , N + 1) fore(j , g + 1) dp[i][j]= INF; dp[0][0] = 0; ranges[0] = {0 , INT_MIN}; forr(i , 1 , N) { forr(j , 1 , g) { for(int l = 0 ; l < i ; l++) { dp[i][j] = min(dp[i][j] , dp[l][j - 1] + (ranges[i].second - ranges[l + 1].first + 1) * (ranges[i].second - ranges[l + 1].first + 1) - max(0ll , ranges[l].second - ranges[l + 1].first + 1)*max(0ll , ranges[l].second - ranges[l + 1].first + 1)); } } } ll ans = INF; forr(j , 1 , g) ans = min(ans , dp[N][j]); return ans; }

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

aliens.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...