Submission #1010100

#TimeUsernameProblemLanguageResultExecution timeMemory
1010100oscar1fSemiexpress (JOI17_semiexpress)C++17
100 / 100
66 ms33480 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int TAILLE_MAX=3000+5; int nbTot,nbExpress,nbMoyen,vitLent,vitExpress,vitMoyen,tempsMax,rep; vector<int> possi; int posExpress[TAILLE_MAX]; void calc(int tempsRest,int taille) { //cout<<tempsRest<<" "<<taille<<endl; int ajout; for (int i=0;i<nbMoyen;i++) { if (tempsRest<0 or taille<=0) { return; } ajout=min(tempsRest/vitLent+1,taille); if (i==0) { rep+=ajout; } else { possi.push_back(ajout); } tempsRest-=ajout*vitMoyen; taille-=ajout; } } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>nbTot>>nbExpress>>nbMoyen; cin>>vitLent>>vitExpress>>vitMoyen; cin>>tempsMax; for (int i=1;i<=nbExpress;i++) { cin>>posExpress[i]; } if ((nbTot-1)*vitExpress<=tempsMax) { rep++; } for (int i=1;i<nbExpress;i++) { calc(tempsMax-(posExpress[i]-1)*vitExpress,posExpress[i+1]-posExpress[i]); } sort(possi.begin(),possi.end()); reverse(possi.begin(),possi.end()); for (int i=0;i<min(nbMoyen-nbExpress,(int)possi.size());i++) { rep+=possi[i]; } cout<<rep-1<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...