Submission #1358581

#TimeUsernameProblemLanguageResultExecution timeMemory
1358581haithamcoder선물상자 (IOI15_boxes)C++20
10 / 100
0 ms344 KiB
#include "boxes.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

const ll LOG = 31;
const ll MOD = 1000000007;
const ll inf = 1e17;
const ll B = 2305843009213693951;


#define db(x) cerr << #x << " = " << x << " | "
#define dbg(x) cerr << #x << " = " << x << "\n"

#define Algerian ios::sync_with_stdio(0);
#define OI cin.tie(NULL);

ll delivery(int n, int k, int l, int p[]) {
    // unordered_map<ll, ll> mp;

    // for (ll i = 0; i < n; i++) mp[p[i]]++;
    
    // // vector<pll> dq;
    // vector<ll> d = {0}, w = {0}, pos = {0};
    // for (auto& [u, v] : mp) pos.push_back(u);
    // sort(pos.begin(), pos.end());
    // ll t = pos.size();
    // for (ll i = 1; i < t; i++) {
    //     d.push_back(pos[i] - pos[i - 1]);
    //     w.push_back(mp[pos[i]]);
    // }
    // pos.push_back(n);
    // d.push_back(n - pos.back());
    // w.push_back(0);
    // t++;

    ll res = 0;
    for (ll i = 0; i < n; i++) {
        res += min(p[i], l - p[i]);
    }

    return 2 * res;

    // vector<ll> pref(t + 1), suf(t + 1), a(t + 1), b(t + 1);
    // for (ll i = 1; i < t; i++) {
    //     a[i] = (a[i - 1] + w[i]) % k;
    //     ll lft = k - a[i];
    //     pref[i] = pref[i - 1] + 2 * d[i];
    //     ll now = w[i] - lft;
    //     pref[i] += pos[i] * w[i];
    // }

    // for (ll i = t - 1; i >= 0; i--) {

    // }
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...