Submission #1288233

#TimeUsernameProblemLanguageResultExecution timeMemory
1288233blackscreen1Wall (IOI14_wall)C++20
0 / 100
128 ms188268 KiB
#include <bits//stdc++.h> #include "wall.h" using namespace std; #define ll int #define iloop(m, h) for (auto i = m; i != h; i += (m < h ? 1 : -1)) #define INF 1000000000000000 struct node { ll s, e, m, l1, l2; node *l, *r; node (ll S, ll E) { s = S, e = E, m = (S+E)>>1; l1 = 0, l2 = INF; if (s != e) { l = new node(s, m); r = new node(m+1, e); } } void prop() { if (s != e) { l->l2 = min(l->l2, l2); l->l1 = max(min(l->l1, l2), l1); r->l2 = min(r->l2, l2); r->l1 = max(min(r->l1, l2), l1); l1 = 0, l2 = INF; } } void upd1(ll S, ll E, ll V) { prop(); if (s == S && e == E) { l1 = max(l1, V); return; } if (E <= m) l->upd1(S, E, V); else if (S > m) r->upd1(S, E, V); else l->upd1(S, m, V), r->upd1(m+1, E, V); } void upd2(ll S, ll E, ll V) { prop(); if (s == S && e == E) { l2 = min(l2, V); l1 = min(l1, V); return; } if (E <= m) l->upd2(S, E, V); else if (S > m) r->upd2(S, E, V); else l->upd2(S, m, V), r->upd2(m+1, E, V); } ll qu(ll X) { prop(); if (s == e) return l1; if (X <= m) return l->qu(X); return r->qu(X); } } *root = new node(0, 2e6); void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ iloop(0, k) { if (op[i] == 1) root->upd1(left[i], right[i], height[i]); else root->upd2(left[i], right[i], height[i]); //cout << i << endl; //iloop(0, n) cout << root.qu(i).first << " "; //cout << endl; } iloop(0, n) finalHeight[i] = root->qu(i); }

Compilation message (stderr)

wall.cpp: In constructor 'node::node(int, int)':
wall.cpp:6:13: warning: overflow in conversion from 'long int' to 'int' changes value from '1000000000000000' to '-1530494976' [-Woverflow]
    6 | #define INF 1000000000000000
      |             ^~~~~~~~~~~~~~~~
wall.cpp:12:30: note: in expansion of macro 'INF'
   12 |                 l1 = 0, l2 = INF;
      |                              ^~~
wall.cpp: In member function 'void node::prop()':
wall.cpp:6:13: warning: overflow in conversion from 'long int' to 'int' changes value from '1000000000000000' to '-1530494976' [-Woverflow]
    6 | #define INF 1000000000000000
      |             ^~~~~~~~~~~~~~~~
wall.cpp:24:38: note: in expansion of macro 'INF'
   24 |                         l1 = 0, l2 = INF;
      |                                      ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...