Submission #762684

#TimeUsernameProblemLanguageResultExecution timeMemory
762684BlancaHMA Huge Tower (CEOI10_tower)C++14
30 / 100
216 ms7500 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long int ll; int mod = 1e9+7; int N, D; vector<int> tamanosBloques; int main() { cin >> N >> D; tamanosBloques = vector<int>(N); for (int i = 0; i < N; i++) { cin >> tamanosBloques[i]; } sort(tamanosBloques.begin(), tamanosBloques.end()); int DP[N], posiblesSegundos[N]; int puntero = N-1; for (int i = N-1; i >= 0; i--) { while (puntero >= 0 && tamanosBloques[i] <= tamanosBloques[puntero]+D) { puntero--; } posiblesSegundos[i] = i-puntero-1; } DP[0] = 1; for (int i = 1; i < N; i++) { DP[i] = (DP[i-1]*1ll*(posiblesSegundos[i]+1))%mod; } cout << DP[N-1] << endl; return 0; }
#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...
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...