Tachibana27 @ 2024-01-30 20:30:14
rt,改了一天了,样例都没过,顺便悬2关
%:include<bits/stdc++.h>
inline int read()<%
int s=0;
int w=1;
char ch=getchar();
for(;ch<'0'||ch>'9';ch=getchar())
if(ch=='-')
w=-1;
for(;ch>='0' and ch<='9';ch=getchar())
s=s*10+ch-'0';
return s*w;
%>
void write(int x)<%
if(x<0)<%
putchar('-');
x=-x;
%>
if(x>9)
write(x/10);
putchar(x%10+'0');
return;
%>
int n,m;
int ans;
bool tog[10000086];
int a[10000086];
bool top[1086][1086];
int dep[10000086];
std::queue<int>q;
class node{
public:
int u;
int v;
}e[1000086];
int head[1000086];
int point;
void add(int u,int v){
e[++point]={v,head[u]};
head[u]=point;
}
int topo(){
while(!q.empty()){
int x=q.front();
q.pop();
for(int i=head[x];i;i=e[i].v){
int y=e[i].u;
dep[y]--;
if(!dep[y])
q.push(y);
}
ans++;
}
return ans;
}
int main()<%
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
n=read();
m=read();
while(m--){
memset(tog,false,sizeof tog);
int s;
s=read();
for(int i=1;i<=s;i++){
a[i]=read();
tog[a[i]]=true;
}
for(int i=a[1];i<=a[s];i++)
if(!tog[i])
for(int j=1;j<=s;j++)
if(!top[i][a[j]]){
top[i][a[j]]=true;
add(i,a[j]);
dep[a[j]]++;
}
}
for(int i=1;i<=n;i++)
if(!dep[i])
q.push(i);
write(topo()-1);
return 0;
%>
by Super_Builder @ 2024-01-30 21:03:47
码风太差,不看了@xltx2012
by AKPC @ 2024-01-31 08:06:50
@xltx2012 普及组建议自己调(
by rhq2022 @ 2024-01-31 08:09:22
不是我不想帮你 @xltx2012 ,你这什么114514的码风,我调一下逝世看吧
by rhq2022 @ 2024-01-31 08:14:04
调不出来,懒得调了
by Restart_Justin @ 2024-02-29 11:54:47
不是,你键盘的 { 不会是坏了吧(