답안 #1094750

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1094750 2024-09-30T12:53:03 Z asli_bg 비밀 (JOI14_secret) C++11
0 / 100
309 ms 4436 KB
#pragma GCC optimize("O3,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

//#define int long long

#include "secret.h"

#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
 
#define FOR(i,a) for(int i=0;i<(a);i++)
#define FORE(i,a,b) for(int i=(a);i<(b);i++)
#define cont(x) {for(auto el:x) cout<<el<<' ';cout<<endl;}
#define contp(x) {for(auto el:x) cout<<el.fi<<'-'<<el.se<<' ';cout<<endl;}
#define sp <<" "<<
#define mid (l+r)/2
#define endl '\n'
 
#define DEBUG(X) {cout<<#X<<' '<<(X)<<endl;}
 
#define carp(x,y) ((x%MOD)*(y%MOD))%MOD
#define topla(x,y) ((x%MOD)+(y%MOD))%MOD
 
typedef vector<int> vi;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<bool> vb;

const int MAXN=1e3+5;
const int MAXK=20;

vi a;
int n;
int tut[MAXK][MAXN];
int mask[MAXN];

void dq(int l,int r,int lev){
    if(l>=r) return;

    tut[lev][mid]=a[mid];
    tut[lev][mid+1]=a[mid+1];

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

    for(int i=mid+1;i<=r;i++) mask[i]=mask[i]^(1<<lev);

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


void Init(int N, int A[]) {
    a.resize(N+1);
    FOR(i,N) a[i+1]=A[i];
    dq(1,N,1);
}

int Query(int l, int r) {
    l++; r++;
    if(l==r) return a[l];
    int bits=__builtin_ctz(mask[l]^mask[r]);
    return 34031541;
}

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:72:9: warning: unused variable 'bits' [-Wunused-variable]
   72 |     int bits=__builtin_ctz(mask[l]^mask[r]);
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 81 ms 2464 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 34031541.
2 Incorrect 79 ms 2388 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 34031541.
3 Incorrect 80 ms 2388 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 34031541.
4 Incorrect 305 ms 4436 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34031541.
5 Incorrect 309 ms 4436 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 34031541.
6 Incorrect 308 ms 4436 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 34031541.
7 Incorrect 302 ms 4432 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 34031541.
8 Incorrect 305 ms 4436 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 34031541.
9 Incorrect 302 ms 4408 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 34031541.
10 Incorrect 301 ms 4356 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 34031541.