답안 #70255

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
70255 2018-08-22T14:16:42 Z MladenP 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include "secret.h"
#define m (l+r)/2
#define G return
#define s Secret
#define I int
int n,i,a[2e3],d[2e3][2e3];void Z(I l,I r){if(l>=r)G;for(i=m+1;i<=r;i++)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-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);}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-1,L,R);}I Query(I L,I R){L++;R++;if(L==R)G a[L];G Q(1,n,L,R);}

Compilation message

secret.cpp:6:14: error: size of array 'a' has non-integral type 'double'
 int n,i,a[2e3],d[2e3][2e3];void Z(I l,I r){if(l>=r)G;for(i=m+1;i<=r;i++)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-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);}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-1,L,R);}I Query(I L,I R){L++;R++;if(L==R)G a[L];G Q(1,n,L,R);}
              ^
secret.cpp:6:26: error: size of array 'd' has non-integral type 'double'
 int n,i,a[2e3],d[2e3][2e3];void Z(I l,I r){if(l>=r)G;for(i=m+1;i<=r;i++)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-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);}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-1,L,R);}I Query(I L,I R){L++;R++;if(L==R)G a[L];G Q(1,n,L,R);}
                          ^
secret.cpp:6:26: error: size of array 'd' has non-integral type 'double'