Submission #110211

#TimeUsernameProblemLanguageResultExecution timeMemory
110211ArturgoBoxes with souvenirs (IOI15_boxes)C++14
20 / 100
4 ms384 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++) { int allerRetour = min(nbSections, 2 * 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--) { int allerRetour = min(nbSections, 2 * (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...