답안 #222100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
222100 2020-04-12T06:34:24 Z Vimmer Kisik (COCI19_kisik) C++14
0 / 90
73 ms 131076 KB
#include <bits/stdc++.h>

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 100005
#define MOD ll(998244353)

using namespace std;

typedef long long ll;

typedef long double ld;


int main()
{

    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, k;

    cin >> n >> k;

    ll a[n], b[n];

    pair <ll, ll> dp[n + 1][k + 1];

    for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= k; j++) dp[i][j].F = dp[i][j].S = 1e9;

    dp[0][0].F = dp[0][0].S = 0;

    for (int i = 0; i < n; i++)
        for (int j = 0; j <= min(i, k); j++)
        {
            if (dp[i + 1][j].F * dp[i + 1][j].S > dp[i][j].F * dp[i][j].S) dp[i + 1][j] = dp[i][j];

            if (j == k) continue;

            ll len = dp[i][j].F + a[i];

            ll hg = max(b[i], dp[i][j].S);

            if (len * hg < dp[i + 1][j + 1].F * dp[i + 1][j + 1].S) {dp[i + 1][j + 1].F = len; dp[i + 1][j + 1].S = hg;}
        }
    cout << dp[n][k].F * dp[n][k].S;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 1408 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1920 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 73 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -