Submission #30504

# Submission time Handle Problem Language Result Execution time Memory
30504 2017-07-24T08:27:32 Z zoomswk Aliens (IOI16_aliens) C++14
12 / 100
206 ms 4796 KB
#include "aliens.h"
#include <bits/stdc++.h>
using namespace std;

vector<pair<int, int>> p;
int L[100005], R[100005];
long long dp[505][505];

long long take_photos(int n, int m, int k, std::vector<int> r, std::vector<int> c){
    for(int i=0; i<n; i++) p.push_back({min(r[i], c[i]), -max(r[i], c[i])});
    sort(p.begin(), p.end());
    int N=1, tmp_mx=-1;
    for(int i=0; i<n; i++){
        if(-p[i].second > tmp_mx){
            L[N] = p[i].first, R[N] = -p[i].second;
            tmp_mx = -p[i].second;
            N++;
        }
    }
    N--;
    for(int i=1; i<=N; i++){
        dp[i][0] = 1e18;
        for(int j=1; j<=k; j++){
            dp[i][j] = 1e18;
            for(int x=1; x<=i; x++){
                dp[i][j] = min(dp[i][j], dp[x-1][j-1]+1LL*(R[i]-L[x]+1)*(R[i]-L[x]+1)-(R[x-1] > L[x] ? 1LL*(R[x-1]-L[x]+1)*(R[x-1]-L[x]+1): 0LL));
            }
        }
    }
    return dp[N][min(N, k)];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4796 KB Correct answer: answer = 4
2 Correct 0 ms 4796 KB Correct answer: answer = 4
3 Correct 0 ms 4796 KB Correct answer: answer = 4
4 Incorrect 0 ms 4796 KB Wrong answer: output = 13, expected = 12
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4796 KB Correct answer: answer = 1
2 Correct 0 ms 4796 KB Correct answer: answer = 4
3 Correct 0 ms 4796 KB Correct answer: answer = 1
4 Correct 0 ms 4796 KB Correct answer: answer = 5
5 Correct 0 ms 4796 KB Correct answer: answer = 41
6 Correct 0 ms 4796 KB Correct answer: answer = 71923
7 Correct 0 ms 4796 KB Correct answer: answer = 77137
8 Correct 76 ms 4796 KB Correct answer: answer = 764
9 Correct 0 ms 4796 KB Correct answer: answer = 250000
10 Correct 206 ms 4796 KB Correct answer: answer = 500
11 Correct 0 ms 4796 KB Correct answer: answer = 32
12 Correct 0 ms 4796 KB Correct answer: answer = 130050
13 Correct 16 ms 4796 KB Correct answer: answer = 5110
14 Correct 0 ms 4796 KB Correct answer: answer = 2626
15 Correct 6 ms 4796 KB Correct answer: answer = 796
16 Correct 9 ms 4796 KB Correct answer: answer = 7580
17 Correct 46 ms 4796 KB Correct answer: answer = 1904
18 Correct 0 ms 4796 KB Correct answer: answer = 996004
19 Correct 6 ms 4796 KB Correct answer: answer = 38817
20 Correct 26 ms 4796 KB Correct answer: answer = 4096
21 Correct 0 ms 4796 KB Correct answer: answer = 1
22 Correct 0 ms 4796 KB Correct answer: answer = 1
23 Correct 53 ms 4796 KB Correct answer: answer = 2040
24 Correct 0 ms 4796 KB Correct answer: answer = 2
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4796 KB Correct answer: answer = 4
2 Correct 0 ms 4796 KB Correct answer: answer = 4
3 Correct 0 ms 4796 KB Correct answer: answer = 4
4 Incorrect 0 ms 4796 KB Wrong answer: output = 13, expected = 12
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4796 KB Correct answer: answer = 4
2 Correct 0 ms 4796 KB Correct answer: answer = 4
3 Correct 0 ms 4796 KB Correct answer: answer = 4
4 Incorrect 0 ms 4796 KB Wrong answer: output = 13, expected = 12
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4796 KB Correct answer: answer = 4
2 Correct 0 ms 4796 KB Correct answer: answer = 4
3 Correct 0 ms 4796 KB Correct answer: answer = 4
4 Incorrect 0 ms 4796 KB Wrong answer: output = 13, expected = 12
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 4796 KB Correct answer: answer = 4
2 Correct 0 ms 4796 KB Correct answer: answer = 4
3 Correct 0 ms 4796 KB Correct answer: answer = 4
4 Incorrect 0 ms 4796 KB Wrong answer: output = 13, expected = 12
5 Halted 0 ms 0 KB -