Submission #110212

#TimeUsernameProblemLanguageResultExecution timeMemory
110212ArturgoBoxes with souvenirs (IOI15_boxes)C++14
20 / 100
4 ms412 KiB
#include "boxes.h" #include <vector> #include <iostream> #include <algorithm> using namespace std; long long delivery(int nbEquipes, int maxPorte, int nbSections, int positions[]) { vector<long long> tempsAvant(nbEquipes, 0), tempsApres(nbEquipes, 0); sort(positions, positions + nbEquipes); int nbPorte = 0; long long curSomme = 0; for(int iEquipe = 0;iEquipe < nbEquipes;iEquipe++) { long long allerRetour = min<long long>(nbSections, 2ll * positions[iEquipe]); tempsAvant[iEquipe] = curSomme + allerRetour; nbPorte++; if(nbPorte == maxPorte) { curSomme += allerRetour; nbPorte = 0; } } nbPorte = 0; curSomme = 0; for(int iEquipe = nbEquipes - 1;iEquipe >= 0;iEquipe--) { long long allerRetour = min<long long>(nbSections, 2ll * (nbSections - positions[iEquipe])); tempsApres[iEquipe] = curSomme + allerRetour; nbPorte++; if(nbPorte == maxPorte) { curSomme += allerRetour; nbPorte = 0; } } long long minTemps = min(tempsAvant[nbEquipes - 1], tempsApres[0]); for(int iEquipe = 0;iEquipe < nbEquipes - 1;iEquipe++) { minTemps = min(minTemps, tempsAvant[iEquipe] + tempsApres[iEquipe + 1]); } return minTemps; }
#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...