Submission #28742

# Submission time Handle Problem Language Result Execution time Memory
28742 2017-07-16T12:37:43 Z repeating Aliens (IOI16_aliens) C++11
0 / 100
0 ms 3020 KB
#include <bits/stdc++.h>
#include "aliens.h"
#define F first
#define S second
#define P push
#define pb push_back
#define MEM(dp,i) memset(dp,i,sizeof(dp))
#define W while
#define R return
#define C continue
#define SI size()
#define ll long long
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define SF(x) scanf("%I64d",&x)
#define SF2(x,y) scanf("%I64d%I64d",&x,&y)
#define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z)
#define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o)
#define all(v) v.begin(),v.end()

using namespace std;
const long long INF = 1e15;
const int MX=200015;
int n,m,k;
int dp[505][505];
int a[505];
int DP(int x,int y){
    if(x==n)R 0;
    if(y==k)R INF;
    int &ret=dp[x][y];
    if(ret!=-1)R ret;
    ret=INF;
    for(int i=x;i<n;i++){
        ret=min(ret,DP(i+1,y+1)+(a[i]-a[x]+1)*(a[i]-a[x]+1));
    }
    R ret;
}
long long take_photos(int n_, int m_, int k_, vector<int> r, vector<int> c) {
    MEM(dp,-1);
    n=n_,m=m_,k=k_;
    for(int i=0;i<n;i++){
        a[i]=r[i];
    }
    sort(a,a+n);
    return DP(0,0);
}

Compilation message

aliens.cpp: In function 'int DP(int, int)':
aliens.cpp:30:15: warning: overflow in implicit constant conversion [-Woverflow]
     if(y==k)R INF;
               ^
aliens.cpp:33:8: warning: overflow in implicit constant conversion [-Woverflow]
     ret=INF;
        ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3020 KB Wrong answer: output = -1530494976, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3020 KB Wrong answer: output = -1530494976, expected = 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3020 KB Wrong answer: output = -1530494976, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3020 KB Wrong answer: output = -1530494976, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3020 KB Wrong answer: output = -1530494976, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3020 KB Wrong answer: output = -1530494976, expected = 4
2 Halted 0 ms 0 KB -