Submission #656877

#TimeUsernameProblemLanguageResultExecution timeMemory
656877Danilo21Secret (JOI14_secret)C++17
100 / 100
472 ms12364 KiB
#include <bits/stdc++.h> #include "secret.h" #define ll long long #define ld long double #define pb push_back #define fi first #define se second #define en '\n' #define sp ' ' #define tb '\t' #define ri(n) int n; cin >> n #define rl(n) ll n; cin >> n #define rs(s) string s; cin >> s #define rc(c) char c; cin >> c #define rv(v) for (auto &x : v) cin >> x #define pven(v) for (auto x : v) cout << x << en #define pv(v) for (auto x : v) cout << x << sp; cout << en #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define yes cout << "YES" << en #define no cout << "NO" << en #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) #define ssort(a, b) if (a < b) swap(a, b) #define bitcnt(a) __builtin_popcountll(a) #define bithigh(a) 63-__builtin_clzll(a) #define lg bithigh ll highpow(ll a) { return 1LL << (ll)lg(a); } using namespace std; const ll LINF = 4e18; const int mxN = 1e3+10, INF = 2e9; ll n, m, a[mxN], table[mxN][mxN]; void Build(int l, int r){ if (l == r) return; int m = (l + r)>>1; for (int i = m-1; i >= l; i--) if (!~table[i][m]) table[i][m] = Secret(a[i], table[i+1][m]); for (int i = m+2; i <= r; i++) if (!~table[m+1][i]) table[m+1][i] = Secret(table[m+1][i-1], a[i]); Build(l, m); Build(m+1, r); } void Init(int N, int A[]) { memset(table, -1, sizeof(table)); n = N; for (int i = 0; i < n; i++) a[i] = table[i][i] = A[i]; Build(0, n-1); } int Query(int L, int R) { if (~table[L][R]) return table[L][R]; for (int i = L; i < R; i++) if (~table[L][i] && ~table[i+1][R]) return Secret(table[L][i], table[i+1][R]); }

Compilation message (stderr)

secret.cpp: In function 'long long int highpow(long long int)':
secret.cpp:27:22: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   27 | #define bithigh(a) 63-__builtin_clzll(a)
      |                      ^
secret.cpp:28:12: note: in expansion of macro 'bithigh'
   28 | #define lg bithigh
      |            ^~~~~~~
secret.cpp:29:38: note: in expansion of macro 'lg'
   29 | ll highpow(ll a) { return 1LL << (ll)lg(a); }
      |                                      ^~
secret.cpp: In function 'int Query(int, int)':
secret.cpp:63:1: warning: control reaches end of non-void function [-Wreturn-type]
   63 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...