Submission #907382

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9073822024-01-15 12:49:06mickey080929Two Antennas (JOI19_antennas)C++17
100 / 100
563 ms61008 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e18;
struct Node{
ll mx, mn, ans;
};
struct Tag{
ll mx, mn;
};
struct SegmentTree{
vector<Node> tree;
vector<Tag> lazy;
void init(ll n) {
ll sz = 1 << __lg(n-1) + 2;
tree.assign(sz, {-inf, inf, -1});
lazy.assign(sz, {-inf, inf});
}
Node Merge(Node u, Node v) {
return {max(u.mx, v.mx), min(u.mn, v.mn), max(u.ans, v.ans)};
}
void propagate(ll node, ll s, ll e) {
tree[node].ans = max({tree[node].ans, lazy[node].mx - tree[node].mn, tree[node].mx - lazy[node].mn});
if (s != e) {
for (auto &i : {node*2, node*2+1}) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

antennas.cpp: In member function 'void SegmentTree::init(ll)':
antennas.cpp:20:26: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   20 |   ll sz = 1 << __lg(n-1) + 2;
      |                ~~~~~~~~~~^~~
antennas.cpp: In member function 'void SegmentTree::update(ll, ll, ll, ll, ll, ll)':
antennas.cpp:45:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   45 |   ll mid = s + e >> 1;
      |            ~~^~~
antennas.cpp: In member function 'void SegmentTree::modify(ll, ll, ll, ll, ll)':
antennas.cpp:64:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   64 |   ll mid = s + e >> 1;
      |            ~~^~~
antennas.cpp: In member function 'll SegmentTree::query(ll, ll, ll, ll, ll)':
antennas.cpp:73:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   73 |   ll mid = s + e >> 1;
      |            ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...