#include "aliens.h"
#include<bits/stdc++.h>
using namespace std;
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
#define fall(i,a,b) for(int i=a;i<=b;i++)
#define rfall(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
const ll inf=1e15;
typedef pair<ll,ll> pii;
ll sq(ll x){
return x*x;
}
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
sort(all(r));
vector<vector<ll>> dp(n+1,vector<ll> (k+1,inf));
fall(j,0,k) dp[0][j]=0;
ll ans=inf;
fall(i,1,n){
fall(j,0,k-1){
rfall(x,i-1,0) dp[i][j]=min(dp[i][j],dp[x][j+1]+sq(r[i-1]-r[x]+1));
if(i==n) ans=min(ans,dp[i][j]);
}
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
aliens.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
aliens_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |