Submission #605856

#TimeUsernameProblemLanguageResultExecution timeMemory
605856kawaiiSecret (JOI14_secret)C++14
0 / 100
507 ms8296 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 = 0; i < N; i++) a[i] = A[i]; for(int i = 0; i < N - 1; i++) pre[i][i + 1] = Secret(a[i], a[i + 1]); for(int i = 2; i <= 9; i++){ for(int j = 0; 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 = a[L]; int diff = R - L + 1; while(diff){ int p = (diff & -diff); // cout << diff <<" "<< p << "\n"; ans = Secret(ans, pre[L][L + p - 1]); diff -= p; L += p; } 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...