Submission #582772

#TimeUsernameProblemLanguageResultExecution timeMemory
582772MohamedFaresNebiliBoxes with souvenirs (IOI15_boxes)C++14
0 / 100
1 ms212 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

        using namespace std;
        using namespace __gnu_pbds;

        using ll = long long;
        using pi = pair<ll, pair<ll, ll>>;
        using ii = pair<int, int>;

        #define pb push_back
        #define pp pop_back
        #define ff first
        #define ss second

        typedef tree<int, null_type, less<int>, rb_tree_tag,
            tree_order_statistics_node_update> indexed_set;

        ll delivery(int N, int K, int L, int P[]) {
            ll res = 1e18;
            for(int l = 0; l < N; l++) {
                ll lo = ll(P[l]) * 2ll;
                ll hi = 0;
                if(l < N - 1)
                    hi = ll(L - P[l + 1]) * 2ll;
                res = min(res, lo + hi);
            }
            return res;
        }

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:19:32: warning: unused parameter 'K' [-Wunused-parameter]
   19 |         ll delivery(int N, int K, int L, int P[]) {
      |                            ~~~~^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...