Submission #150981

# Submission time Handle Problem Language Result Execution time Memory
150981 2019-09-01T13:54:05 Z osaaateiasavtnl Secret (JOI14_secret) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "secret.h"
using namespace std;
#define int long long 
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
const int N = 1001;
int mem[N][N];
void prec(int l, int r) {
    if (l == r) return;
    int m = (l + r) >> 1;
    prec(l, m); prec(m + 1, r);
    for (int i = m - 1; i >= l; --i) mem[i][m] = Secret(mem[i][i], mem[i + 1][m]);
    for (int i = m + 2; i <= r; ++i) mem[m][i] = Secret(mem[m + 1][i - 1], mem[i][i]);
}   
void Init(int n, int a[]) {
    for (int i = 1; i <= n; ++i) mem[i][i] = a[i];
    prec(1, n);
}   
int get(int tl, int tr, int l, int r) {
    if (tl == tr) return mem[tl][tl];
    int tm = (tl + tr) >> 1;
    if (r <= tm) return get(tl, tm, l, r);
    if (tm + 1, tr, l, r) return get(tm + 1, tr, l, r);
    return Secret(mem[l][tm], mem[tm + 1][r]);
}   
int Query(int l, int r) { return get(1, n, l, r); }

Compilation message

secret.cpp: In function 'long long int get(long long int, long long int, long long int, long long int)':
secret.cpp:30:12: warning: left operand of comma operator has no effect [-Wunused-value]
     if (tm + 1, tr, l, r) return get(tm + 1, tr, l, r);
         ~~~^~~
secret.cpp:30:21: warning: right operand of comma operator has no effect [-Wunused-value]
     if (tm + 1, tr, l, r) return get(tm + 1, tr, l, r);
                     ^
secret.cpp:30:24: warning: right operand of comma operator has no effect [-Wunused-value]
     if (tm + 1, tr, l, r) return get(tm + 1, tr, l, r);
                        ^
secret.cpp: In function 'long long int Query(long long int, long long int)':
secret.cpp:33:41: error: 'n' was not declared in this scope
 int Query(int l, int r) { return get(1, n, l, r); }
                                         ^