This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
//Aliens - Knuth opt variant
using namespace std;
long long dp[5000][5000]; //dp[i][k]: Minimum cost for covering the first i segments with k pictures (obviously i>=k)
long long opt[5000][5000];
//Why tf are there segments here? Refer to the official editorial for that - the expaination seems good enough
struct seg{
long long Start;
long long End;
};
seg Segments[5003];
//Custom sort function for removing uneeded segments. If a segment which starts at L and end at R is kept, alongside with another segment which starts at L' and end as R', and L'<= L <= R <= R' (aka: The segment is completely covered), the DP will become absolute shitfuckery and extremely wrong (trust me, I thought it would work but it didn't)
bool operator< (const seg &x, const seg &y){
if(x.Start==y.Start){
return x.End>y.End;
}else{
return x.Start<y.Start;
}
}
long long take_photos(int N,int M, int K, vector <int> Rows, vector <int> Columns){
return 0;
}
# | 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... |