Submission #1195901

#TimeUsernameProblemLanguageResultExecution timeMemory
1195901nikulidBoxes with souvenirs (IOI15_boxes)C++20
0 / 100
2096 ms320 KiB
/*


IOI2015 BOXES.CPP


*/


#include "boxes.h"
#include <vector>
#include <math.h>
#include <algorithm>

using namespace std;
#define ll long long

/*
    Lemma: 
    this is dp and I will move on to q2 after getting the first subtask
[solved]
    New Lemma:
    the second subtask does not use dp.
    hence I will only move on to q2 after solving the first two subtasks
[solved]
    Even newer Lemma:
    the third subtask is brute force. 
    brute force > dp
    hence I will only move on to q2 after solving the first three subtasks
[solved]
    Newest Lemma:
    I think maybe some more why not
*/

vector<bool> haps;
ll gL;

ll dist(ll a, ll b){
    ll A = max(a,b);
    ll B = min(a,b);
    return min(A-B, gL-A+B);
}

// pseudocode-ahh solution
// so goofy

long long delivery(int N, int K, int L, int p[]) {
    if(1==1){
        // perhaps we can get 50...
        // pick different places to start? 

        ll ans = 100000000000000000;
        ll nA;
        int tS, tE;
        for(int s=0; s<K; s++){
            // different starting places...
            nA=0;
            for(int i=s; i<L; i+=s){
                tS = i; // index of starting participant
                tE = (i+s-1)%N; // index of ending participant
                nA += dist(0, p[tS]);
                nA += dist(p[tS], p[tE]);
                nA += dist(p[tE], 0);
            }
            ans = min(ans, nA);
        }

        return ans;
    }
    return 0;
}
#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...