# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1110109 |
2024-11-08T17:51:03 Z |
SSKMF |
Peru (RMI20_peru) |
C++17 |
|
1 ms |
2384 KB |
const int mod(1000000007);
long long temporar[2500002] , *minim = temporar + 1;
int candidati[2500001];
int solve (int lungime , int limita , int *sir)
{
int rezultat = 0 , stanga = 1 , dreapta = 0;
for (int indice = 0 ; indice < lungime ; indice++)
{
while (stanga <= dreapta && sir[candidati[dreapta]] <= sir[indice])
{ dreapta--; }
candidati[++dreapta] = indice;
if (candidati[stanga] == indice - limita)
{ stanga++; }
int __stanga = stanga , __dreapta = dreapta - 1;
while (__dreapta - __stanga > 1)
{
const int mijloc = (__stanga + __dreapta) >> 1;
if (sir[candidati[mijloc]] + (mijloc == stanga ? minim[indice - limita] : minim[candidati[mijloc - 1]]) >= sir[candidati[mijloc + 1]] + minim[candidati[mijloc]])
{ __stanga = mijloc; }
else
{ __dreapta = mijloc; }
}
if (__stanga < __dreapta && sir[candidati[__stanga]] + (__stanga == stanga ? minim[indice - limita] : minim[candidati[__stanga - 1]]) >= sir[candidati[__dreapta]] + minim[candidati[__stanga]])
{ __stanga++; }
minim[indice] = sir[candidati[__stanga]] + (__stanga == stanga ? minim[indice - limita] : minim[candidati[__stanga - 1]]);
rezultat = (23LL * rezultat + minim[indice]) % mod;
}
return rezultat;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |