Submission #728521

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7285212023-04-22 14:48:55piOOEFood Court (JOI21_foodcourt)C++17
100 / 100
529 ms44420 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
namespace SegmentTree {
constexpr int N_ = 1 << 19;
pair<ll, ll> t[N_]; // f(x) = max(0, x - t[i].first) + t[i].second
int sz = 1;
void init(int n) {
sz = 1 << __lg(n) + !!(n & (n - 1));
}
void apply(int x, pair<ll, ll> d) {
if (t[x].second >= d.first) {
t[x] = {t[x].first, t[x].second - d.first + d.second};
} else {
t[x] = {t[x].first + d.first - t[x].second, d.second};
}
}
void push(int x) {
if (t[x].first || t[x].second) {
apply(x << 1, t[x]), apply(x << 1 | 1, t[x]);
t[x] = {};
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

foodcourt.cpp: In function 'void SegmentTree::init(int)':
foodcourt.cpp:15:27: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   15 |         sz = 1 << __lg(n) + !!(n & (n - 1));
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
foodcourt.cpp: In function 'void SegmentTree::rangeApply(int, int, std::pair<long long int, long long int>, int, int, int)':
foodcourt.cpp:41:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   41 |         int mid = lx + rx >> 1;
      |                   ~~~^~~~
foodcourt.cpp: In function 'void SegmentTreeMin::init(int)':
foodcourt.cpp:62:27: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   62 |         sz = 1 << __lg(n) + !!(n & (n - 1));
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
foodcourt.cpp: In function 'void SegmentTreeMin::rangeAdd(int, int, ll, int, int, int)':
foodcourt.cpp:82:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   82 |         int mid = lx + rx >> 1;
      |                   ~~~^~~~
foodcourt.cpp: In lambda function:
foodcourt.cpp:172:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  172 |         if (pnt[i] == que[i].size()) {
      |             ~~~~~~~^~~~~~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...