QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#415663 | #4236. Triangular Logs | littlecat# | Compile Error | / | / | C++23 | 2.3kb | 2024-05-21 08:30:41 | 2024-05-21 08:30:42 |
Judging History
answer
#pragma GCC optimize("O3")
#include <iostream>
using namespace std;
#include <vector>
#define pb push_back
template<class C> using vc=vector<C>;
#include <algorithm>
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define smax(a,b) a=max(a,b)
#define f first
#define s second
typedef pair<int,int> pi;
const int mx=100000, T=50, sz=1000000001;
//if no triangle, heights must be fibonacci
//phi^10 = L_10 = (2) 1 3 4 7 11 18 29 47 76 (123)
//phi^50 > 2*10^10 -> 50 suffices
vc<int> V; int qx,qy,qv, qxl,qxr,qyl,qyr;
namespace node
{
const int N=100000000;
int alloc=0;
int l[N],r[N]; vc<int> v[N];
void ins(int i, int L, int R)
{
if(qy<L||qy>=R) return;
if(v[i].size()<T) v[i].pb(qv);
if(R==L+1) return;
if(!l[i]) l[i]=alloc++, r[i]=alloc++;
ins(l[i],L,(L+R)>>1), ins(r[i],(L+R)>>1,R);
}
void qry(int i, int L, int R)
{
if(V.size()>=T||qyl>=R||qyr<=L||v[i].empty()) return;
if(qyl<=L&&qyr>=R)
{
for(int t:v[i]) if(V.size()<T) V.pb(t);
return;
}
if(!l[i]) return;
qry(l[i],L,(L+R)>>1), qry(r[i],(L+R)>>1,R);
}
}
namespace Node
{
const int N=1000000;
int alloc=1; //node 0 is root, already used
int l[N],r[N]; int v[N];
void ins(int i, int L, int R)
{
if(qx<L||qx>=R) return;
node::ins(v[i],0,sz);
if(R==L+1) return;
if(!l[i]) l[i]=alloc++, r[i]=alloc++,
v[l[i]]=node::alloc++, v[r[i]]=node::alloc++;
ins(l[i],L,(L+R)>>1), ins(r[i],(L+R)>>1,R);
}
void qry(int i, int L, int R)
{
if(V.size()>=T||qxl>=R||qxr<=L) return;
if(qxl<=L&&qxr>=R)
{
node::qry(v[i],0,sz);
return;
}
if(!l[i]) return;
qry(l[i],L,(L+R)>>1), qry(r[i],(L+R)>>1,R);
}
}
int main()
{
cin.sync_with_stdio(0), cin.tie(0), cout.sync_with_stdio(0), cout.tie(0);
int n,q; cin>>n>>q;
For(i,0,n) cin>>qx>>qy>>qv, Node::ins(0,0,sz);
For(i,0,q)
{
cin>>qxl>>qyl>>qxr>>qyr,qxr++,qyr++, V.clear(), Node::qry(0,0,sz);
sort(V.begin(),V.end());
int ans=0;
for(int i=0; i+2<V.size(); i++) if(V[i]+V[i+1]>V[i+2]) ans=1;
cout<<ans<<'\n';
}
}
Details
/tmp/ccKFZjg4.o: in function `node::ins(int, int, int)': answer.code:(.text+0x446): relocation truncated to fit: R_X86_64_PC32 against symbol `qy' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x465): relocation truncated to fit: R_X86_64_PC32 against symbol `node::r' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x46e): relocation truncated to fit: R_X86_64_PC32 against symbol `node::l' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x4bd): relocation truncated to fit: R_X86_64_PC32 against symbol `node::alloc' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x4cc): relocation truncated to fit: R_X86_64_PC32 against symbol `node::alloc' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x4eb): relocation truncated to fit: R_X86_64_PC32 against symbol `qy' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x51d): relocation truncated to fit: R_X86_64_PC32 against symbol `qy' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x550): relocation truncated to fit: R_X86_64_PC32 against symbol `qv' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x5ac): relocation truncated to fit: R_X86_64_PC32 against symbol `qv' defined in .bss section in /tmp/ccKFZjg4.o /tmp/ccKFZjg4.o: in function `node::qry(int, int, int)': answer.code:(.text+0x718): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/ccKFZjg4.o answer.code:(.text+0x722): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status