제출 #1187535

#제출 시각아이디문제언어결과실행 시간메모리
1187535mattsohNew Home (APIO18_new_home)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef int ll; const ll maxn = 3e5 + 10; const ll maxy = 1e8 + 10; array<ll,4> stores[maxn]; vector<array<ll,4>> events[maxn]; pair<ll,ll> queries[maxn]; set<ll> evy; ll res[maxn]; int stx[maxn][4 * maxn]; map<ll, ll> loc_id; vector<ll> locs; void update(ll type, ll id, ll left, ll right,ll x,ll val) { if (x>right || x <left) return; if (left == right){ stx[type][id] += val; return; } ll mid = (left+right)/2; if (x <= mid){ update(type, id*2, left, mid, x, val); } else{ update(type, id*2+1, mid+1, right, x, val); } stx[type][id] = stx[type][2*id] + stx[type][2*id+1]; } ll get(ll type, ll id, ll left, ll right, ll l, ll r) { if (stx[type][id] == 0 || l>right || r<left) return -1; if (left==right) return left; ll mid = (left+right)/2; ll res = get(type, 2*id+1, mid+1, right, l,r); if (res != -1) return res; return get(type, 2*id, left, mid, l,r); } int main() { ll n,k,q; cin>>n>>k>>q; for (ll i = 0;i<n;i++) { ll x,t,s,e; cin>>x>>t>>s>>e; stores[i] = {x,t-1,s,e}; locs.push_back(x); } for (ll i = 0; i < q; i++) { ll l, y; cin >> l >> y; queries[i] = {l, y}; locs.push_back(l); } sort(locs.begin(),locs.end()); ll sz = locs.size(); for (ll i = 0;i<sz;i++) { loc_id[locs[i]] = i; } for (ll i = 0; i < n; i++) { auto [x, t, s, e] = stores[i]; ll xi = loc_id[x]; events[s].push_back({0, t, xi, -1}); events[e + 1].push_back({1, t, xi, -1}); evy.insert(s); evy.insert(e+1); } for (ll i = 0; i < q; i++) { auto [l, y] = queries[i]; ll li = loc_id[l]; events[y].push_back({2, -1, li, i}); evy.insert(y); } for (ll i: evy) { auto evs = events[i]; for (auto [type, t, xi, qi] : evs) { if (type == 0) { update(t, 1, 0, sz,xi,1); } else if (type == 1) { update(t, 1, 0, sz,xi,-1); } else { ll maxx = -1; for (ll j = 0; j < k; ++j) { ll left = get(j,1,0,sz,0,xi); ll right = get(j,1,0,sz,xi+1,sz); if (left == -1 && right == -1) { maxx = -1; break; } ll dist = maxy; if (left != -1) dist = min(dist, abs(locs[xi] - locs[left])); if (right != -1) dist = min(dist, abs(locs[xi] - locs[right])); maxx = max(maxx, dist); } res[qi] = maxx; } } } for (ll i = 0;i<q;i++){ cout<<res[i]<<endl; } }

컴파일 시 표준 에러 (stderr) 메시지

/usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(ios_init.o): in function `std::ios_base::Init::Init()':
(.text._ZNSt8ios_base4InitC2Ev+0x1c): failed to convert GOTPCREL relocation against '_ZNSt8ios_base4Init11_S_refcountE'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x60): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x67): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x72): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x87): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0x92): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0xa7): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0xb2): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0xc1): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0xd4): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cin_sync' defined in .bss._ZN14__gnu_internal12buf_cin_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0xdb): relocation truncated to fit: R_X86_64_PC32 against symbol `__gnu_internal::buf_cout_sync' defined in .bss._ZN14__gnu_internal13buf_cout_syncE section in /usr/lib/gcc/x86_64-linux-gnu/11/libstdc++.a(globals_io.o)
(.text._ZNSt8ios_base4InitC2Ev+0xe2): additional relocation overflows omitted from the output
(.text._ZNSt8ios_base4InitC2Ev+0x1c6): failed to convert GOTPCREL relocation against '_ZSt4cout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x260): failed to convert GOTPCREL relocation against '_ZSt3cin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x2e2): failed to convert GOTPCREL relocation against '_ZSt4cerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x353): failed to convert GOTPCREL relocation against '_ZSt4clog'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x541): failed to convert GOTPCREL relocation against '_ZSt5wcout'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x5e5): failed to convert GOTPCREL relocation against '_ZSt4wcin'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x670): failed to convert GOTPCREL relocation against '_ZSt5wcerr'; relink with --no-relax
(.text._ZNSt8ios_base4InitC2Ev+0x6e9): failed to convert GOTPCREL relocation against '_ZSt5wclog'; relink with --no-relax
collect2: error: ld returned 1 exit status