Submission #605893

#TimeUsernameProblemLanguageResultExecution timeMemory
605893kawaiiSecret (JOI14_secret)C++14
30 / 100
496 ms8428 KiB
#include "secret.h" #include<bits/stdc++.h> using namespace std; int a[1005], pre[1005][1005]; void Init(int N, int A[]){ for(int i = 1; i <= N; i++) a[i] = A[i - 1]; for(int i = 1; i <= N; i++) pre[i][i] = a[i]; for(int i = 1; i <= 9; i++){ for(int j = 1; j + (1 << i) - 1 <= N; j++){ pre[j][j + (1 << i) - 1] = Secret(pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]); } } } int Query(int L, int R){ int ans = -1; L++; R++; int diff = R - L + 1; // cout << diff <<" "; for(int i = 0; i <= 9; i++){ if((1 << i) & diff){ if(ans == -1) ans = pre[L][L + (1 << i) - 1]; else ans = Secret(ans, pre[L][L + (1 << i) - 1]); L += (1 << i); } } return ans; }

Compilation message (stderr)

secret.cpp: In function 'void Init(int, int*)':
secret.cpp:12:66: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   12 |             pre[j][j + (1 << i) - 1] = Secret(pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]);
      |                                                                ~~^~~
secret.cpp:12:93: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   12 |             pre[j][j + (1 << i) - 1] = Secret(pre[j][j + (1 << i - 1) - 1], pre[j + (1 << i - 1)][j + (1 << i) - 1]);
      |                                                                                           ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...