QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#481162#906. 强连通分量xyloph0nex17#Compile Error//C++141.8kb2024-07-16 21:00:052024-07-16 21:00:06

Judging History

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

  • [2024-07-16 21:00:06]
  • 评测
  • [2024-07-16 21:00:05]
  • 提交

answer

//El Psy Kongroo
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ri int
#define TIME (1e3 * clock() / CLOCKS_PER_SEC)
using namespace std ;
template <typename T>
inline void read(T&x){
	x = 0 ; char c = getchar() ; bool flg = 1 ; while(c > '9' || c < '0'){if(c == '-')flg = 0 ; c = getchar() ;}
	while(c >= '0' && c <= '9'){x = (x << 1) + (x << 3) + (c ^ 48) ; c = getchar() ;} x = flg ? x : -x ;
}
template <typename T,typename ...Args>
inline void read(T&x,Args&...args){read(x),read(args...);}
bool m_bg ;
const int N = 5e5 + 10 ;
struct star{int to,pre ;}e[N*2] ; int head[N<<1],strn=1 ;
struct line{int u,v ;}L[N] ;
void add(int u,int v){e[++strn].to=v,e[strn].pre=head[u],head[u]=strn ;}
int dfn[N],low[N],dfnn,sc[N],scn,stk[N],top ; vector<int>scc[N] ;
void tarjan(int u){
	dfn[u] = low[u] = ++dfnn ; stk[++top] = u ;
	for(ri i = head[u] , v ; i ; i = e[i].pre){
		v=e[i].to ;
		if(!dfn[v])tarjan(v),low[u]=min(low[u],low[v]) ;
		else if(!sc[v])low[u]=min(low[u],dfn[v]) ;
	}
	if(dfn[u]==low[u]){
		sc[u]=++scn£¬scc[scn].pb(u)
		while(top&&stk[top]!=u)sc[stk[top]]=scn,scc[scn].pb(stk[top]),top-- ;
		top-- ;
	}
}
int n,m ; vector<int>G[N] ;
queue<int>q ; int d[N] ;
void topo(){
	for(ri i = 1 ; i <= scn ; i++)if(!d[i])q.push(i) ;
	while(!q.empty()){
		int u = q.front() ; q.pop() ; printf("%d ",(int)scc[u].size()) ; for(ri p : scc[u])printf("%d ",p-1) ; printf("\n") ;
		for(ri v : G[u])if(!--d[v])q.push(v) ;
	}
}
bool m_ed ;
signed main(){
	//freopen("a.in","r",stdin) ;
	read(n,m) ; for(ri i = 1 , u , v ; i <= m ; i++)read(u,v),u++,v++,add(u,v),L[i]={u,v} ;
	for(ri i = 1 ; i <= n ; i++)if(!dfn[i])tarjan(i) ;
	printf("%d\n",scn) ;
	for(ri i = 1 , u , v ; i <= m ; i++){
		u = sc[L[i].u] , v = sc[L[i].v] ;
		if(u!=v)G[u].pb(v),d[v]++ ; 
	}topo() ;
	return 0 ;
}

Details

answer.code:29:25: error: extended character £ is not valid in an identifier
   29 |                 sc[u]=++scn£¬scc[scn].pb(u)
      |                         ^
answer.code:29:25: error: extended character ¬ is not valid in an identifier
answer.code: In function ‘void tarjan(int)’:
answer.code:29:25: error: ‘scn£¬scc’ was not declared in this scope
   29 |                 sc[u]=++scn£¬scc[scn].pb(u)
      |                         ^~~~~~~~