Submission #790483

#TimeUsernameProblemLanguageResultExecution timeMemory
790483AndreySecret (JOI14_secret)C++14
0 / 100
378 ms4448 KiB
#include "secret.h" #include<bits/stdc++.h> using namespace std; int pr[1001][10]; int su[1001][10]; void Init(int n, int a[]) { for(int i = 0; i < n; i++) { pr[i][0] = a[i]; su[i][0] = a[i]; } for(int i = 1; i < 10; i++) { for(int j = 0; j < n; j++) { if(j%(1 << i) < (1 << (i-1))) { pr[j][i] = pr[j][i-1]; } else { pr[j][i] = Secret(pr[j-1][i],a[j]); } } } for(int i = 1; i < 10; i++) { for(int j = n-1; j >= 0; j--) { if(su[j][i]%(1 << i) == 0) { su[j][i] = pr[min(n-1,j+(1 << i)-1)][i]; } else { if(j%(1 << i) >= (1 << (i-1)) || j == n-1) { su[j][i] = su[j][i-1]; } else { su[j][i] = Secret(a[j],su[j+1][i]); } } } } } int Query(int l, int r) { if(l == r) { return pr[l][0]; } for(int i = 0; i < 10; i++) { if(l/(1 << (i+1)) == r/(1 << (i+1))) { return Secret(su[l][i],pr[r][i]); } } }

Compilation message (stderr)

secret.cpp: In function 'int Query(int, int)':
secret.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...