QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#640441 | #906. 强连通分量 | Zhou_JK | Compile Error | / | / | C++23 | 1.4kb | 2024-10-14 12:34:25 | 2024-10-14 12:34:26 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<vector>
#include<bitset>
using namespace std;
constexpr int N=500005;
int n,m;
bitset<N>mp[N],rmp[N];
bitset<N>vis;
int out[N],ind;
void dfs(int x)
{
bitset<N> now;vis[x]=1;
for(now=mp[x]^(mp[x]&vis);now.any();now=mp[x]^(mp[x]&vis))
dfs(now._Find_first());
out[++ind]=x;
}
vector<int>pos;
vector<vector<int>>block;
int tot;
void dfsrev(int x)
{
pos.push_back(x);
bitset<N> now;vis[x]=1;
for(now=rmp[x]^(rmp[x]&vis);now.any();now=rmp[x]^(rmp[x]&vis))
{
dfsrev(now._Find_first());
}
return;
}
int kosaraju()
{
vis.reset();ind=0;
for(int i=1;i<=n;++i) if(!vis[i]) dfs(i);
vis.reset();int res=0;
for(int i=n,x;i;--i) if(!vis[out[i]])
{
pos.clear();
dfsrev(out[i]);
tot++;
block.emplace_back(pos);
}
return res;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
cin>>n>>m;
for(int i=1;i<=m;i++)
{
int u,v;
cin>>u>>v;
u++,v++;
mp[u][v]=1;
rmp[v][u]=1;
}
cerr<<"ed\n";
kosaraju();
cout<<tot<<"\n";
for(int i=0;i<tot;i++)
{
int l=block[i].size();
cout<<l;
for(int u:block[i])
cout<<" "<<u-1;
cout<<"\n";
}
return 0;
}
Details
/tmp/ccyFoSr5.o: in function `dfs(int)': answer.code:(.text+0x7b): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text+0xcf): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text+0x1a0): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text+0x1da): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccyFoSr5.o /tmp/ccyFoSr5.o: in function `kosaraju()': answer.code:(.text+0x60b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text+0x65d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyFoSr5.o /tmp/ccyFoSr5.o: in function `main': answer.code:(.text.startup+0x33): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text.startup+0x58): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text.startup+0x66): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text.startup+0x8f): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccyFoSr5.o answer.code:(.text.startup+0x108): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status