Submission #466680

#TimeUsernameProblemLanguageResultExecution timeMemory
466680jli12345Wall (IOI14_wall)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void fastIO(){ ios_base::sync_with_stdio(false); cin.tie(0); } pair<int, int> st[8000100]; pair<int, int> combine(pair<int, int> orig, pair<int, int> upd){ if (upd.second > orig.first){ return {upd.second, upd.second}; } else if (upd.first < orig.second){ return {upd.first, upd.first}; } else { return {min(orig.first, upd.first), max(orig.second, upd.second)}; } } void pushdown(int node){ st[node*2] = combine(st[node*2], st[node]); st[node*2+1] = combine(st[node*2+1], st[node]); } void U(int node, int l, int r, int tl, int tr, pair<int, int> upd){ if (l >tr || r < tl) return; if (l >= tl && r <= tr){ st[node] = combine(st[node], upd); //cout << l << " " << r << " " << st[node].first << " " << st[node].second << "\n"; return; } pushdown(node); int mid = (l+r)/2; U(node*2, l, mid, tl, tr, upd); U(node*2+1, mid+1, r, tl, tr, upd); st[node].first = max(st[node*2].first, st[node*2+1].first); st[node].second = min(st[node*2].second, st[node*2+1].second); } int Q(int node, int l, int r, int ind){ if (l > ind || r < ind){ return 0; } if (l == r){ return st[node].first; } pushdown(node); int mid = (l+r)/2; st[node].first = max(st[node*2].first, st[node*2+1].first); st[node].second = min(st[node*2].second, st[node*2+1].second); return max(Q(node*2, l, mid, ind), Q(node*2+1, mid+1, r, ind)); } void buildWall(int n, int k, int op[], int lb[], int rb[], int height[], int finalHeight[]){ for (int i = 0; i < k; i++){ if (op[i] == 1){ U(1, 0, n-1, lb[i], rb[i], {0x3f3f3f3f, height[i]}); } else { U(1, 0, n-1, lb[i], rb[i], {height[i], 0}); } } for (int i = 0; i < n; i++){ finalHeight[i] = Q(1, 0, n-1, i); } } int n, k; int op[2000100], lb[2000100], rb[2000100], height[2000100], finalHeight[2000100]; int main(){ //fastIO(); cin >> n >> k; for (int i = 0; i < k; i++){ cin >>op[i] >> lb[i] >> rb[i] >> height[i]; } buildWall(n, k, op, lb, rb, height, finalHeight); for (int i = 0; i < n; i++) cout << finalHeight[i] << " "; cout << "\n"; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc0xOABl.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cclZLmPo.o:wall.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status