# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1211679 | cpdreamer | Aliens (IOI16_aliens) | C++20 | 0 ms | 0 KiB |
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e12;
typedef long long ll;
const ll MOD=(ll) 998244353;
#define P pair
#define S second
#define F first
#define pb push_back
#define V vector
#define all(v) v.begin(),v.end()
long long take_photos(int n, int m, int k, std::vector<int> &r, std::vector<int> &c) {
V<int>d;
sort(all(r));
for(int i=0;i<n;i++){
d.pb(r[i+1]-r[i]);
}
sort(all(d));
ll cost=n;
for(int i=0;i<n-k;i++){
cost+=d[i]-1;
}
return cost;
}