QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#99114#5504. Flower GardenMaverikCompile Error//C++174.7kb2023-04-21 11:09:112023-04-21 11:09:16

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-21 11:09:16]
  • 评测
  • [2023-04-21 11:09:11]
  • 提交

answer

#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int maxn=2e7+10;
#define ls (p<<1)
#define rs (p<<1|1)
#define mid ((t[p].l+t[p].r)>>1)
int n,Q,m;
int val[maxn],deg[maxn],ans[maxn];
int dfn[maxn],low[maxn],num,scn,sccval[maxn],bl[maxn];
vector<int>scc[maxn];
bool ins[maxn],vis[maxn];
stack<int>stk;
vector<int>e[maxn],g[maxn],ung[maxn];
inline void dadd(int x,int y){e[x].pb(y),e[y].pb(x);}
inline void add(int x,int y){e[x].pb(y);}
int idin[maxn],idout[maxn],idx;
struct Segment_In
{
    int up;
    struct node{int l,r;}t[maxn];
    inline void build(int p,int l,int r)
    {
        t[p].l=l,t[p].r=r;
        if(l==r) return idin[l]=p+up,void();
        add(p+up,ls+up),add(p+up,rs+up);
        build(ls,l,mid),build(rs,mid+1,r);
    }
    inline void addin(int p,int l,int r,int fm)
    {
        if(l<=t[p].l && t[p].r<=r) return add(fm,p+up);
        if(l<=mid) addin(ls,l,r,fm);
        if(r>mid) addin(rs,l,r,fm);
    }
    inline void buildin()
    {up=idx;build(1,1,m);idx+=5;}
}in;
struct Segment_Out
{
    int up;
    struct node{int l,r;}t[maxn];
    inline void build(int p,int l,int r)
    {
        t[p].l=l,t[p].r=r;
        if(l==r) return idout[l]=p+up,add(idin[l],l),add(l,idout[l]),void();
        add(ls+up,p+up),add(rs+up,p+up);
        build(ls,l,mid),build(rs,mid+1,r);
    }
    inline void addout(int p,int l,int r,int to)
    {
        if(l<=t[p].l && t[p].r<=r) return add(p+up,to);
        if(l<=mid) addout(ls,l,r,to);
        if(r>mid) addout(rs,l,r,to);
    }
    inline void buildout()
    {up=idx;build(1,1,m);idx+=5;}
}out;
inline void addseg(int l1,int r1,int l2,int r2){idx++;out.addout(1,l1,r1,idx),in.addin(1,l2,r2,idx);}
#undef ls
#undef rs
#undef mid


inline void tarjan(int x)
{
    dfn[x]=low[x]=++num,stk.push(x),ins[x]=1;
    for(auto y:e[x])
        if(!dfn[y]) tarjan(y),low[x]=min(low[x],low[y]);
        else if(ins[y]) low[x]=min(low[x],dfn[y]);
    if(dfn[x]==low[x])
    {
        scn++;int y;
        do
        {
            y=stk.top();stk.pop();ins[y]=0;
            scc[scn].pb(y);bl[y]=scn,sccval[scn]+=val[y];
        }while(x!=y);
    }
}
inline void printans()
{
    cout<<"TAK"<<'\n';
    for(int i=1;i<=m;i++) 
        if(ans[i]) cout<<"F";
        else cout<<"R";
    cout<<'\n';
}
inline void init()
{
    for(int i=0;i<maxn;i++)
    {
        e[i].clear(),g[i].clear(),ung[i].clear(),scc[i].clear();
        vis[i]=ins[i]=dfn[i]=low[i]=bl[i]=val[i]=sccval[i]=ans[i]=deg[i]=0;
        idin[i]=idout[i]=0;
    }
    idx=n=m=Q=num=scn=0;
    memset(in.t,0x00,sizeof(in.t));
    memset(out.t,0x00,sizeof(out.t));
    while(!stk.empty()) stk.pop();
}
inline void solve()
{
    cin>>n>>Q,idx=m=3*n;
    in.buildin(),out.buildout();
    for(int i=1,a,b,c,d;i<=Q;i++) cin>>a>>b>>c>>d,addseg(a,b,c,d);
    for(int i=1;i<=m;i++) val[i]=1;
    for(int i=1;i<=idx;i++) if(!dfn[i]) tarjan(i);
    for(int x=1;x<=idx;x++) for(auto y:e[x]) if(bl[y]!=bl[x])
        g[bl[x]].pb(bl[y]),deg[bl[y]]++,ung[bl[y]].pb(bl[x]);
    vector<int>res;
    for(int i=1;i<=scn;i++) if(sccval[i]>=n)
    {
        queue<int>q;
        for(int j=1;j<=m;j++) vis[j]=0;
        res.clear();q.push(i),vis[i]=1;
        while(!q.empty())
        {
            int x=q.front();q.pop();
            for(auto ele:scc[x]) if(ele<=m) res.pb(ele);
            for(auto y:g[x]) if(!vis[y]) q.push(y),vis[y]=1;
        }
        if(res.size()<=2*n) 
        {
            for(auto ele:res) ans[ele]=1;
            return printans(),init(),void();
        }
        
        for(int j=1;j<=m;j++) vis[j]=0;
        res.clear();q.push(i),vis[i]=1;
        while(!q.empty())
        {
            int x=q.front();q.pop();
            for(auto ele:scc[x]) if(ele<=m) res.pb(ele);
            for(auto y:ung[x]) if(!vis[y]) q.push(y),vis[y]=1; 
        }
        if(res.size()<=2*n) 
        {
            for(auto ele:res) ans[ele]=1;
            return printans(),init(),void();
        }  
    }
    
    queue<int>q;res.clear();
    for(int i=1;i<=scn;i++) if(!deg[i]) q.push(i);
    vector<int>tops;
    while(!q.empty())
    {
        int x=q.front();q.pop();tops.pb(x);
        for(auto y:g[x]) if(--deg[y]==0) q.push(y);
    }
    for(auto e:tops)
    {
        for(auto ele:scc[e]) if(ele<=m) res.pb(ele);
        if(n<=res.size() && res.size()<=2*n)
        {
            for(int i=1;i<=m;i++) ans[i]=1;
            for(auto ele:res) ans[ele]=0;
            return printans(),init(),void();
        } 
    }
    cout<<"NIE"<<'\n';init();
}
signed main()
{
    ios::sync_with_stdio(false);cin.tie(NULL);
    int Testcase;cin>>Testcase;
    while(Testcase--) solve();
    return 0;
}

Details

/tmp/ccLUP1nU.o: in function `tarjan(int)':
answer.code:(.text._Z6tarjani[_Z6tarjani]+0xd): relocation truncated to fit: R_X86_64_PC32 against symbol `low' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x1a): relocation truncated to fit: R_X86_64_PC32 against symbol `dfn' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x6b): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x16b): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x18f): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x272): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x29c): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x382): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x3a6): relocation truncated to fit: R_X86_64_PC32 against symbol `num' defined in .bss section in /tmp/ccLUP1nU.o
answer.code:(.text._Z6tarjani[_Z6tarjani]+0x632): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status