답안 #994324

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994324 2024-06-07T11:15:47 Z nngan267 비밀 (JOI14_secret) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ii pair<int, int>
#define fi first
#define se second
#define pll pair<ll, ll>
#define vi vector<int>
#define db long double

const int maxn = 1e6+5;
const ll mod = 1e9+7;
const ll inf = 1e18;
const double eps = 1e-9;
const double pi = acos(-1);
const int block_size = 320;

#include "secret.h"

int n, a[maxn];
ll acc[15][1005];
int mask[1005];

void cal(int lev, int l, int r){
    if(l == r) return;
    int mid = (l+r)/2;

    acc[lev][mid] = a[mid];
    for(int i=mid-1; i>=l; i--){
        acc[lev][i] = Secret(acc[lev][i+1], a[i]);
    }
    acc[lev][mid+1] = a[mid+1];
    for(int i=mid+2; i<=r; i++){
        acc[lev][i] = Secret(acc[lev][i-1], a[i]);
    }

    for(int i=mid+1, i<=r; i++){
        mask[i] |= (1<<lev);
    }

    cal(lev+1, l, mid);
    cal(lev+1, mid+1, r);
}

void init(int N, int A[]){
    n = N;
    for(int i=0; i<n; i++){
        a[i] = A[i];
    }
    cal(0, 0, n-1);
}

int Query(int l, int r){
    if(l == r) return a[l];
    int lvl = __builtin_ctz(mask[l] ^ mask[r]);
    return Secret(acc[lvl][l], acc[lvl][r]);
}

//int main(){
//    freopen("ngan.inp", "r", stdin);
//    freopen("ngan.out", "w", stdout);
//    ios_base::sync_with_stdio(0);
//    cin.tie(0); cout.tie(0);
//    int test; cin >> test;
//    while(test--){
//        solve();
//    }
//
//}

Compilation message

secret.cpp: In function 'void cal(int, int, int)':
secret.cpp:38:23: error: expected ';' before '<=' token
   38 |     for(int i=mid+1, i<=r; i++){
      |                       ^~
      |                       ;
secret.cpp:38:23: error: expected primary-expression before '<=' token
   38 |     for(int i=mid+1, i<=r; i++){
      |                       ^~