Submission #372791

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3727912021-03-01 17:19:13two_sides케이크 (JOI13_cake)C++17
100 / 100
135 ms56428 KiB
#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
const int LG = 19;
int a[N], b[N], rmq[LG][N], lg[N], ID[N];
long long ans[N], sum[2][N];
int getMin(int l, int r) {
int k = lg[r - l + 1];
return a[rmq[k][l]] <
a[rmq[k][r + 1 - (1 << k)]] ?
rmq[k][l] : rmq[k][r + 1 - (1 << k)];
}
long long getSum(int prt, int l, int r) {
return sum[prt][r] - sum[prt][l - 1];
}
void solve(int lef, int rig, long long cur) {
int mid = getMin(lef, rig);
ans[ID[mid]] += cur + a[mid];
for (int l = lef, r = rig;
l < mid || r > mid; ) {
int minP = 0;
if (l < mid) {
int p = getMin(l, mid - 1);
if (a[minP] > a[p]) minP = p;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cake.cpp: In function 'int main()':
cake.cpp:93:42: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   93 |                 a[rmq[k - 1][i + (1 << k - 1)]] ?
      |                                        ~~^~~
cake.cpp:94:56: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   94 |                 rmq[k - 1][i] : rmq[k - 1][i + (1 << k - 1)];
      |                                                      ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...