답안 #70253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70253 2018-08-22T14:14:08 Z MladenP 비밀 (JOI14_secret) C++17
100 / 100
688 ms 8592 KB
#include "secret.h"
#define m (l+r)/2
#define G return
#define s Secret
int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)G;for(int i=m+1;i<=r;i++)d[m][i]=s(d[m][i-1],a[i]);for(int i=m-2;i>=l;i--)d[i][m-1]=s(a[i],d[i+1][m-1]);Z(l,m-1);Z(m+1, r);}void Init(int N,int A[]){for(i=1,n=N;i<=n;i++)a[i]=A[i-1],d[i][i]=a[i];Z(1,N);}int Q(int l,int r,int L,int 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-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)G a[L];G Q(1,n,L,R);}
# 결과 실행 시간 메모리 Grader output
1 Correct 183 ms 4436 KB Output is correct - number of calls to Secret by Init = 3331, maximum number of calls to Secret by Query = 1
2 Correct 172 ms 4456 KB Output is correct - number of calls to Secret by Init = 3340, maximum number of calls to Secret by Query = 1
3 Correct 179 ms 4512 KB Output is correct - number of calls to Secret by Init = 3349, maximum number of calls to Secret by Query = 1
4 Correct 688 ms 8408 KB Output is correct - number of calls to Secret by Init = 7491, maximum number of calls to Secret by Query = 1
5 Correct 656 ms 8492 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
6 Correct 590 ms 8492 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
7 Correct 623 ms 8592 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
8 Correct 647 ms 8592 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
9 Correct 613 ms 8592 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1
10 Correct 635 ms 8592 KB Output is correct - number of calls to Secret by Init = 7499, maximum number of calls to Secret by Query = 1