# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
48697 |
2018-05-18T06:01:23 Z |
faustaadp |
Aliens (IOI16_aliens) |
C++17 |
|
179 ms |
5120 KB |
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
#include "aliens.h"
ll d[550][1010],i,j,b[1010],te,N;
pair<ll,ll> a[1010];
ll inter(ll aa,ll bb)
{
if(bb==N+1)
return 0;
if(a[aa].se<a[bb].fi||a[aa]==a[bb])
return 0;
return (a[bb].fi-a[aa].se+1)*(a[bb].fi-a[aa].se+1);
}
ll depe(ll aa,ll bb)
{
if(aa==N+1)
return 0;
if(bb<=0)
return 1e18;
if(d[aa][bb]==-1)
{
d[aa][bb]=1e18;
ll ii;
for(ii=aa;ii<=N;ii++)
d[aa][bb]=min(d[aa][bb],depe(ii+1,bb-1)+(a[ii].se-a[aa].fi+1)*(a[ii].se-a[aa].fi+1)-inter(ii,ii+1));
}
return d[aa][bb];
}
long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c) {
for(i=0;i<n;i++)
for(j=0;j<n;j++)
{
ll Ki=min(r[i],c[i]);
ll Ka=max(r[i],c[i]);
if(Ki==min(r[j],c[j])&&Ka==max(r[j],c[j])&&i<=j)
continue;
if(Ki<=r[j]&&r[j]<=Ka&&Ki<=c[j]&&c[j]<=Ka)
b[j]=1;
}
for(i=0;i<n;i++)
if(!b[i])
{
te++;
a[te]=mp(min(r[i],c[i]),max(r[i],c[i]));
}
memset(d,-1,sizeof(d));
N=te;
sort(a+1,a+1+N);
// for(i=1;i<=N;i++)
// cout<<a[i].fi<<" "<<a[i].se<<"\n";
// cout<<N<<"\n";
return depe(1,k);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4728 KB |
Correct answer: answer = 4 |
2 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
3 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
4 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 12 |
5 |
Incorrect |
5 ms |
4876 KB |
Wrong answer: output = 64, expected = 52 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4876 KB |
Correct answer: answer = 1 |
2 |
Correct |
5 ms |
4876 KB |
Correct answer: answer = 4 |
3 |
Correct |
6 ms |
4896 KB |
Correct answer: answer = 1 |
4 |
Correct |
5 ms |
4924 KB |
Correct answer: answer = 5 |
5 |
Correct |
5 ms |
4924 KB |
Correct answer: answer = 41 |
6 |
Correct |
5 ms |
4924 KB |
Correct answer: answer = 71923 |
7 |
Correct |
6 ms |
4972 KB |
Correct answer: answer = 77137 |
8 |
Correct |
93 ms |
5120 KB |
Correct answer: answer = 764 |
9 |
Correct |
7 ms |
5120 KB |
Correct answer: answer = 250000 |
10 |
Correct |
179 ms |
5120 KB |
Correct answer: answer = 500 |
11 |
Correct |
5 ms |
5120 KB |
Correct answer: answer = 32 |
12 |
Correct |
6 ms |
5120 KB |
Correct answer: answer = 130050 |
13 |
Correct |
50 ms |
5120 KB |
Correct answer: answer = 5110 |
14 |
Correct |
11 ms |
5120 KB |
Correct answer: answer = 2626 |
15 |
Correct |
21 ms |
5120 KB |
Correct answer: answer = 796 |
16 |
Correct |
37 ms |
5120 KB |
Correct answer: answer = 7580 |
17 |
Correct |
117 ms |
5120 KB |
Correct answer: answer = 1904 |
18 |
Correct |
6 ms |
5120 KB |
Correct answer: answer = 996004 |
19 |
Correct |
18 ms |
5120 KB |
Correct answer: answer = 38817 |
20 |
Correct |
54 ms |
5120 KB |
Correct answer: answer = 4096 |
21 |
Correct |
6 ms |
5120 KB |
Correct answer: answer = 1 |
22 |
Correct |
7 ms |
5120 KB |
Correct answer: answer = 1 |
23 |
Correct |
106 ms |
5120 KB |
Correct answer: answer = 2040 |
24 |
Correct |
6 ms |
5120 KB |
Correct answer: answer = 2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4728 KB |
Correct answer: answer = 4 |
2 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
3 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
4 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 12 |
5 |
Incorrect |
5 ms |
4876 KB |
Wrong answer: output = 64, expected = 52 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4728 KB |
Correct answer: answer = 4 |
2 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
3 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
4 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 12 |
5 |
Incorrect |
5 ms |
4876 KB |
Wrong answer: output = 64, expected = 52 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4728 KB |
Correct answer: answer = 4 |
2 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
3 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
4 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 12 |
5 |
Incorrect |
5 ms |
4876 KB |
Wrong answer: output = 64, expected = 52 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
4728 KB |
Correct answer: answer = 4 |
2 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
3 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 4 |
4 |
Correct |
5 ms |
4828 KB |
Correct answer: answer = 12 |
5 |
Incorrect |
5 ms |
4876 KB |
Wrong answer: output = 64, expected = 52 |
6 |
Halted |
0 ms |
0 KB |
- |