#include <bits/stdc++.h>
#include "aliens.h"
using namespace std;
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
    vector<pair<int,int>> tm,st;
    for(int i=0;i<n;i++){
        if(r[i]>c[i])swap(r[i],c[i]);
        tm.push_back({r[i],c[i]});
    }
    sort(tm.begin(),tm.end(),[](pair<int,int> p1,pair<int,int> p2){
        if(p1.first!=p2.first)return p1.first<p2.first;
        return p1.second>p2.second;
    });
    st.push_back({-1,-1});
    for(auto p:tm){
        if(st.empty()||p.first>st.back().first)st.push_back(p);
    }
    n=st.size()-1;
    long long dp[n+1],a[n+1],h[n+1];
    for(int i=0;i<=n;i++){
        a[i]=st[i].second+1;
        h[i]=st[i].second-st[i].first+1;
    }
    dp[0]=0;
    for(int i=1;i<=n;i++){
        dp[i]=1e18;
        for(long long x=h[i];x<=a[i];x++){
            long long len=max(0LL,x-a[i]+a[i-1]);
            dp[i]=min(dp[i],x*x-len*len+dp[i-1]);
        }
    }
    return dp[n];
}
Compilation message (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... |