제출 #790519

#제출 시각아이디문제언어결과실행 시간메모리
790519skittles1412고대 책들 (IOI17_books)C++17
0 / 100
1 ms212 KiB
#include "bits/extc++.h"

using namespace std;

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t;
    ((cerr << " | " << u), ...);
    cerr << endl;
}

#ifdef DEBUG
#define dbg(...)                                              \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
    dbgh(__VA_ARGS__)
#else
#define dbg(...)
#define cerr   \
    if (false) \
    cerr
#endif

using ll = long long;

#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))

ll minimum_walk(vector<int> arr, int kv) {
    int n = sz(arr), trans[n - 1] {};
    for (int i = 0; i < n; i++) {
        for (int j = i; j < arr[i]; j++) {
            trans[j]++;
        }
    }
    ll ans = 0;
    for (auto& a : trans) {
        a = max(a, 1);
        ans += a * 2;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...