# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70247 | 2018-08-22T14:10:53 Z | MladenP | Secret (JOI14_secret) | C++17 | Compilation error |
0 ms | 0 KB |
#include "secret.h" #define m (l+r)/2 #define r return #define s Secret int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);}
Compilation message
secret.cpp:3:11: error: expected ',' or '...' before 'return' #define r return ^ secret.cpp:5:48: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp: In function 'void Z(int, int)': secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:5:57: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:5:57: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:71: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:71: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:5:78: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ';' before 'return' #define r return ^ secret.cpp:5:78: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:5:78: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:5:78: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:5:83: error: expected ';' before ')' token int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:120: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:120: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:138: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:138: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:5:162: error: expected ']' before ';' token int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:167: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:167: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:174: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:174: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp: At global scope: secret.cpp:3:11: error: expected ',' or '...' before 'return' #define r return ^ secret.cpp:5:278: note: in expansion of macro 'r' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp: In function 'int Q(int, int)': secret.cpp:5:296: error: 'L' was not declared in this scope int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected primary-expression before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:298: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:3:11: error: expected ')' before 'return' #define r return ^ secret.cpp:2:14: note: in expansion of macro 'r' #define m (l+r)/2 ^ secret.cpp:5:298: note: in expansion of macro 'm' int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);} ^ secret.cpp:5:328: error: expected ')' before ';' token int n,i,a[1010],d[1010][1010];void Z(int l,int r){if(l>=r)r;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)r s(d[L][m-1],d[m][R]);if(L==m)r d[m][R];if(m<L)r Q(m+1,r,L,R);r Q(l,m-1,L,R);}int Query(int L,int R){L++;R++;if(L==R)r a[L];r Q(1,n,L,R);}