답안 #689647

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
689647 2023-01-29T04:36:40 Z zeroesandones Discharging (NOI20_discharging) C++17
0 / 100
95 ms 17708 KB
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;

#define FOR(i, j, k) for (ll i = j; i < (ll) k; ++i)
#define FORD(i, j, k) for (ll i = j; i >= (ll) k; --i)
#define nl "\n"
#define sp " "

#define all(x) (x).begin(), (x).end()
#define sc second
#define fr first
#define pb emplace_back

// Binary Search, maybe

void solve()
{
    ll n;
    cin >> n;

    ll t[n + 1];
    FOR(i, 1, n + 1)
        cin >> t[i];

    // ll dp[n + 1][n + 1];
    // dp[i][j] = min time taken for the first i customers if they are in j groups

    // four possbilities
    // all three in one group
    ll op1 = max({t[1], t[2], t[3]}) * 3;
    // all three in seperate groups
    ll op2 = t[1] * 3 + t[2] * 2 + t[3];
    // first two in one group
    ll op3 = max(t[1], t[2]) * 3 + t[3];
    // last two in one group
    ll op4 = t[1] * 3 + max(t[2], t[3]);

    cout << min({op1, op2, op3, op4}) << nl;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 95 ms 17708 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -