Submission #491927

#TimeUsernameProblemLanguageResultExecution timeMemory
491927hoanghq2004Wall (IOI14_wall)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") using namespace std; const int Nmax = 2e6 + 10; int n, q; struct node { int minlazy, maxlazy; } st[Nmax * 4]; void push_max(int id, int val) { if (val == - 1e9) return; st[id].maxlazy = max(st[id].maxlazy, val); st[id].minlazy = max(st[id].maxlazy, st[id].minlazy); } void push_min(int id, int val) { if (val == 1e9) return; st[id].minlazy = min(st[id].minlazy, val); st[id].maxlazy = min(st[id].minlazy, st[id].maxlazy); } void minimize(int id, int L, int R, int u, int v, int val) { if (u > R || L > v) return; if (u <= L && R <= v) { push_min(id, val); return; } push_min(id * 2, st[id].minlazy); push_min(id * 2 + 1, st[id].minlazy); push_max(id * 2, st[id].maxlazy); push_max(id * 2 + 1, st[id].maxlazy); st[id].maxlazy = - 1e9, st[id].minlazy = 1e9; int mid = L + R >> 1; minimize(id * 2, L, mid, u, v, val); minimize(id * 2 + 1, mid + 1, R, u, v, val); } void maximize(int id, int L, int R, int u, int v, int val) { if (u > R || L > v) return; if (u <= L && R <= v) { push_max(id, val); return; } push_min(id * 2, st[id].minlazy); push_min(id * 2 + 1, st[id].minlazy); push_max(id * 2, st[id].maxlazy); push_max(id * 2 + 1, st[id].maxlazy); st[id].maxlazy = - 1e9, st[id].minlazy = 1e9; int mid = L + R >> 1; maximize(id * 2, L, mid, u, v, val); maximize(id * 2 + 1, mid + 1, R, u, v, val); } int get(int id, int L, int R, int i) { if (L == R) return st[id].maxlazy; push_min(id * 2, st[id].minlazy); push_min(id * 2 + 1, st[id].minlazy); push_max(id * 2, st[id].maxlazy); push_max(id * 2 + 1, st[id].maxlazy); st[id].maxlazy = - 1e9, st[id].minlazy = 1e9; int mid = L + R >> 1; if (i <= mid) return get(id * 2, L, mid, i); else return get(id * 2 + 1, mid + 1, R, i); } int main() { ios :: sync_with_stdio(0); cin.tie(0); cin >> n >> q; while (q--) { int c, L, R, k; cin >> c >> L >> R >> k; if (c == 1) maximize(1, 0, n - 1, L, R, k); else minimize(1, 0, n - 1, L, R, k); } for (int i = 0; i < n; ++i) cout << get(1, 0, n - 1, i) << '\n'; }

Compilation message (stderr)

wall.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("O3")
      | 
wall.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("unroll-loops")
      | 
wall.cpp: In function 'void minimize(int, int, int, int, int, int)':
wall.cpp:39:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   39 |     int mid = L + R >> 1;
      |               ~~^~~
wall.cpp: In function 'void maximize(int, int, int, int, int, int)':
wall.cpp:55:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   55 |     int mid = L + R >> 1;
      |               ~~^~~
wall.cpp: In function 'int get(int, int, int, int)':
wall.cpp:67:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   67 |     int mid = L + R >> 1;
      |               ~~^~~
/usr/bin/ld: /tmp/cceNLQNk.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cchM365k.o:wall.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cceNLQNk.o: in function `main':
grader.cpp:(.text.startup+0x133): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status