are_you_sure @ 2024-11-29 21:01:37
某站
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<iomanip>
using namespace std;
int cnt,a[105],ml[4505],mr[4505];
int main(){
int n,m;
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>ml[i]>>mr[i];
a[mr[i]]++;
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(mr[j]==i){
a[i]=max(a[i],a[ml[j]]+1);
}
}
}
sort(a+1,a+1+n);
for(int i=1;i<=n;i++){
if(a[i]==i-1 && a[i+1]!=i-1)cnt++;
}
cout<<cnt;
return 0;
}
by Redamancy_Lydic @ 2024-11-29 21:13:38
一:不是站外的 P2419