Submission #967779

# Submission time Handle Problem Language Result Execution time Memory
967779 2024-04-22T19:52:39 Z amine_aroua Aliens (IOI16_aliens) C++17
0 / 100
1 ms 348 KB
#pragma once

#include <bits/stdc++.h>
using namespace std;
#define fore(i , n) for(int i = 0;i<n;i++)
#define forr(i , x , y) for(int i = x;i<=y;i++)
#define ll long long
#define pb push_back
const ll INF = 1e18;
long long take_photos(int n, int m, int g, std::vector<int> r, std::vector<int> c)
{
    if(n == 1)
        return 1ll;
    vector<pair<int ,int>> ranges;
    ranges.pb({-1 ,-1});
    fore(i ,n)
    {
        ranges.pb({min(r[i] , c[i]) , max(r[i]  , c[i])});
    }
    int N = n;
    g = min(g , N);
    ll dp[N + 1][g + 1];
    fore(i , N + 1)
        fore(j , g + 1)
            dp[i][j]= INF;
    dp[0][0] = 0;
    forr(i , 1 , N)
    {
        forr(j , 1 , g)
        {
            for(int l = 0 ; l < i ; l++)
            {
                dp[i][j] = min(dp[i][j] , dp[l][j - 1] + (ranges[i].second - ranges[l + 1].first + 1) * (ranges[i].second - ranges[l + 1].first + 1));
            }
        }
    }
    ll ans = INF;
    forr(j , 1 , g)
        ans = min(ans , dp[N][j]);
    return ans;
}

Compilation message

aliens.cpp:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Correct answer: answer = 1
2 Correct 0 ms 348 KB Correct answer: answer = 4
3 Correct 0 ms 348 KB Correct answer: answer = 1
4 Incorrect 0 ms 348 KB Wrong answer: output = 2, expected = 5
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer: output = 1, expected = 4
2 Halted 0 ms 0 KB -