답안 #288242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
288242 2020-09-01T10:47:13 Z Tangent Shortcut (IOI16_shortcut) C++17
0 / 100
1 ms 256 KB
#include <bits/stdc++.h>
#include "shortcut.h"

using namespace std;

//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(), order_of_key()

typedef long long ll;
typedef long double dd;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<dd, dd> pdd;
typedef vector<int> vii;
typedef vector<ll> vll;
typedef vector<dd> vdd;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;
typedef vector<vii> vvii;
typedef vector<vll> vvll;
typedef vector<vdd> vvdd;
typedef vector<vpii> vvpii;
typedef vector<vpll> vvpll;
typedef vector<vpdd> vvpdd;
typedef vector<bool> vb;

const int inf = 1 << 30;

#define rep(i, n) for (ll i = 0; i < n; i++)
#define ffor(i, a, b) for(ll i = a; i < b; i++)
#define forin(x, a) for (auto &x: a)
#define all(x) x.begin(), x.end()

#ifdef TEST
#define dbg(x) cout << #x << ": " << x << '\n';
#define dbgc(x) cout << #x << ":"; forin(a, x) { cout << " " << a; } cout << endl;
#define tassert(x) assert(x);
#else
#define dbg(x)
#define dbgc(x)
#define tassert(x)
#endif

long long find_shortcut(int n, std::vector<int> l, std::vector<int> d, int c) {
    if (n == 2) {
        return (ll) min(l[0], c) + d[0] + d[1];
    }
    vector<tuple<ll, int, int>> dists;
    vll cum = {0};
    forin(x, l) {
        cum.emplace_back(cum.back() + x);
    }
    ll res = numeric_limits<ll>::max();
    rep(i, n - 1) {
        ffor(j, i + 1, n) {
            ll curr = 0;
            rep(i2, n - 1) {
                ffor(j2, i + 1, n) {
                    curr = max(curr, min(cum[j2] - cum[i2], c + abs(cum[i2] - cum[i]) + abs(cum[j2] - cum[j])) + d[i2] + d[j2]);
                }
            }
            res = min(curr, res);
        }
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB n = 4, 80 is a correct answer
2 Incorrect 0 ms 256 KB n = 9, incorrect answer: jury 110 vs contestant 100
3 Halted 0 ms 0 KB -