Submission #674169

#TimeUsernameProblemLanguageResultExecution timeMemory
674169kirakaminski968Wall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <functional> #include <numeric> #include <utility> #include <cassert> #pragma GCC optimize("Ofast") #pragma GCC optimization ("unroll-loops") #pragma GCC target("avx,avx2,fma") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; using pii = pair<int, int>; #define MP make_pair #define FF first #define SS second const int inf = 2000000011; const pii def = MP(-inf, inf); int N, Q; pii T[8000000]; void init(int t = 1, int tl = 0, int tr = N - 1) { if (tl == 0 && tr == N - 1) T[t] = MP(0, 0); else T[t] = def; if (tl == tr) return; int tm = (tl + tr) >> 1; init(t << 1, tl, tm); init(t << 1 | 1, tm + 1, tr); } pii push(pii a, pii b) { if (a.SS < b.FF) return MP(a.SS, a.SS); if (b.SS < a.FF) return MP(a.FF, a.FF); return MP(max(a.FF, b.FF), min(a.SS, b.SS)); } void pushdown(int t) { if (T[t] != def) { T[t << 1] = push(T[t], T[t << 1]); T[t << 1 | 1] = push(T[t], T[t << 1 | 1]); T[t] = def; } } void update(int l, int r, pii v, int t = 1, int tl = 0, int tr = N - 1) { if (r < tl || tr < l) return; if (l <= tl && tr <= r) { T[t] = push(v, T[t]); return; } if (tl != tr) pushdown(t); int tm = (tl + tr) >> 1; update(l, r, v, t << 1, tl, tm); update(l, r, v, t << 1 | 1, tm + 1, tr); } void pushall(int* ans, int t = 1, int tl = 0, int tr = N - 1) { if (tl == tr) { ans[tl] = T[t].FF; return; } else pushdown(t); int tm = (tl + tr) >> 1; pushall(ans, t << 1, tl, tm); pushall(ans, t << 1 | 1, tm + 1, tr); } void buildWall(int n, int k, int* op, int* lb, int* rb, int* h, int* ans) { N = n, Q = k; init(); for (int q = 0; q < Q; q++) { pii v = def; if (op[q] == 1) v.FF = h[q]; else if (op[q] == 2) v.SS = h[q]; update(lb[q], rb[q], v); } pushall(ans); } int n, q, op[500005], lb[500005], rb[500005], h[500005], ans[500005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> q; for (int i = 0; i < q; i++) cin >> op[i] >> lb[i] >> rb[i] >> h[i]; buildWall(n, q, op, lb, rb, h, ans); for (int i = 0; i < n; i++) cout << ans[i] << ' '; cout << endl; }

Compilation message (stderr)

wall.cpp:12: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   12 | #pragma GCC optimization ("unroll-loops")
      | 
/usr/bin/ld: /tmp/ccGJ7EXw.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccSUOMuv.o:wall.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status