#include "secret.h"
#define m (l+r)/2
#define G return
#define s Secret
#define I int
#define F(A,B) for(i=A;i<=B;i++)
I n,i,a[1010],d[1010][1010];void Z(I l,I r){if(l>=r)G;F(m+1,r)d[m][i]=s(d[m][i-1],a[i]);for(i=m-2;i>=l;i--)d[i][m-1]=s(a[i],d[i+1][m-1]);Z(l,m);Z(m+1, r);}void Init(I N, I *A){n=N;F(1,N)a[i]=A[i-1],d[i][i]=a[i];Z(1,N);}I Q(I l,I r,I L,I R){if(L<m&&m<=R)G s(d[L][m-1],d[m][R]);if(L==m)G d[m][R];if(m<L)G Q(m+1,r,L,R);G Q(l,m,L,R);}I Query(I L,I R){L++;R++;if(L==R)G a[L];G Q(1,n,L,R);}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
181 ms |
4344 KB |
Output is correct - number of calls to Secret by Init = 3833, maximum number of calls to Secret by Query = 1 |
2 |
Correct |
181 ms |
4600 KB |
Output is correct - number of calls to Secret by Init = 3842, maximum number of calls to Secret by Query = 1 |
3 |
Correct |
172 ms |
4600 KB |
Output is correct - number of calls to Secret by Init = 3851, maximum number of calls to Secret by Query = 1 |
4 |
Incorrect |
643 ms |
8468 KB |
Output isn't correct - number of calls to Secret by Init = 8456, maximum number of calls to Secret by Query = 1 |
5 |
Incorrect |
659 ms |
8560 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
6 |
Incorrect |
653 ms |
8560 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
7 |
Incorrect |
682 ms |
8560 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
8 |
Incorrect |
641 ms |
8560 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
9 |
Incorrect |
646 ms |
8564 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |
10 |
Incorrect |
622 ms |
8612 KB |
Output isn't correct - number of calls to Secret by Init = 8466, maximum number of calls to Secret by Query = 1 |