Submission #616038

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6160382022-07-31 18:54:13penguinhackerDistributing Candies (IOI21_candies)C++17
0 / 100
160 ms82004 KiB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN=2e5;
const ar<ll, 5> ID={-1, -1, -1, -1, -1};
// store {sum, min, max, up, down}
int n, q;
vector<int> queries[mxN];
ar<ll, 5> st[1<<19];
ar<ll, 5> mk(int x) {
return {x, x, x, max(0, x), min(0, x)};
}
ar<ll, 5> cmb(ar<ll, 5> a, ar<ll, 5> b) {
if (a==ID||b==ID)
return a!=ID?a:b;
return {
a[0]+b[0],
min(a[1], a[0]+b[1]),
max(a[2], a[0]+b[2]),
max({a[3], b[3], a[0]+b[2]-a[1]}),
min({a[4], b[4], a[0]+b[1]-a[2]})
};
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

candies.cpp: In function 'int qry1(int, std::array<long long int, 5>, int, int, int)':
candies.cpp:43:19: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   43 |  if (y==ID||y[3]<x&&y[4]>-x)
candies.cpp: In function 'int qry2(int, int, std::array<long long int, 5>, int, int, int)':
candies.cpp:58:19: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   58 |  if (y==ID||y[3]<x&&y[4]>-x)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...