# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433877 | oscar1f | Boat (APIO16_boat) | C++17 | 2101 ms | 524292 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |