#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 500;
const ll INFLL = 1e18;
ll dp[MAXN+1][MAXN+1];
pair<int, int> all[MAXN];
ll take_photos(int n, int m, int k, vector<int> rows, vector<int> cols) {
    for (int i=0; i<n; i++) {
        if (rows[i] > cols[i])
            swap(rows[i], cols[i]);
        all[i] = {rows[i], -cols[i]};
    }
    sort(all, all+n);
    
    vector<ll> l{-1}, r{-1};
    for (int i=0, N = n; i<N; i++) {
        if (i != 0 and all[i].first == all[i-1].first) {
            n--;
            continue;
        }
        l.push_back(all[i].first);
        r.push_back(-all[i].second);
    }
    // for (int i=1; i<=n; i++) cout << l[i] << ' ' << r[i] << '\n';
    // cout << '\n';
    dp[0][0] = 0;
    for (int i=1; i<=n; i++) dp[i][0] = INFLL;
    for (int i=1; i<=n; i++) {
        for (int ops=1; ops<=k; ops++) {
            dp[i][ops] = dp[i][ops-1];
            // cout << i << ':';
            for (int j=i; j>=1; j--) {
                ll res = dp[j-1][ops-1];
                res += (r[i] - l[j] + 1) * (r[i] - l[j] + 1);
                if (j > 1 and (r[j-1] - l[j] + 1) > 0)
                    res -= (r[j-1] - l[j] + 1) * (r[j-1] - l[j] + 1);
                // cout << res << ' ';
                dp[i][ops] = min(dp[i][ops], res);
            }
            // cout << '\n';
        }
    }
    return dp[n][k];
}
컴파일 시 표준 에러 (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... |