제출 #1310148

#제출 시각아이디문제언어결과실행 시간메모리
1310148ghammazhassan비밀 (JOI14_secret)C++20
30 / 100
369 ms4448 KiB
#include "secret.h" #include <iostream> #include <cmath> #include <algorithm> #include <map> #include <unordered_map> #include <vector> #include <iomanip> #include <string> #include <queue> #include <set> #include <deque> #define MAX_N 1000 #define MAX_Q 10000 #define MAX_VALUE 1000000000 using namespace std; static int N; static int A[MAX_N]; static int Q; static int L[MAX_Q]; static int R[MAX_Q]; static int secret_count; const int NN=1e3+5; const int LOG=10; int st[LOG][NN]; int nn; void makest(){ for (int j=1;j<LOG;j++){ for (int i=0;i<nn-(1<<j)+1;i++){ st[j][i]=Secret(st[j-1][i],st[j-1][i+(1<<(j-1))]); } } } void Init(int n,int a[]){ nn=n; for (int i=0;i<n;i++){ st[0][i]=a[i]; } makest(); // cout << st[1][1] << endl; } int Query(int L,int R){ int k=LOG-1; while(L+(1<<k)-1>R){ k--; } // cout << L << " " << k << " W "; int x=st[k][L]; L+=(1<<k); k--; while (k>=0){ if (L+(1<<k)-1<=R){ // cout << L << " " << k << " W "; x=Secret(x,st[k][L]); L+=(1<<k); } k--; } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...