Submission #433877

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4338772021-06-20 11:47:13oscar1fBoat (APIO16_boat)C++17
9 / 100
2101 ms524292 KiB
#include<bits/stdc++.h>
using namespace std;
const int MAX_ECOLE=501,INFINI=1000*1000*1000+7;
int nbEcole;
map<long long,int> memo;
int mini[MAX_ECOLE],maxi[MAX_ECOLE];
int dyna(int idEcole,int maxMaint) {
if (idEcole==nbEcole+1) {
return 1;
}
if (maxMaint<mini[idEcole]) {
return memo[(long long)idEcole*(long long)INFINI+(long long)maxMaint]=(dyna(idEcole+1,maxMaint)+dyna(idEcole,mini[idEcole]))%INFINI;
}
int val=memo[(long long)idEcole*(long long)INFINI+(long long)maxMaint];
if (val!=0) {
return val;
}
val=dyna(idEcole+1,maxMaint);
if (maxMaint<maxi[idEcole]) {
val+=dyna(idEcole,maxMaint+1);
val%=INFINI;
}
memo[(long long)idEcole*(long long)INFINI+(long long)maxMaint]=val;
return val;
}
int main() {
ios_base::sync_with_stdio(false);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...