RT,蒟蒻挂在 7,8,9 的第三问上了,求调
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<map>
#include<unordered_map>
#include<vector>
#include<queue>
#include<bitset>
#include<set>
#include<ctime>
#include<random>
#define x1 xx1
#define y1 yy1
#define IOS ios::sync_with_stdio(false)
#define ITIE cin.tie(0);
#define OTIE cout.tie(0);
#define PY puts("Yes")
#define PN puts("No")
#define PW puts("-1")
#define popcount __builtin_popcount
using namespace std;
inline int R(){
int x=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}return x*f;
}
inline void write(int x){
if(x<0){x=-x;putchar('-');}
int y=0;char z[70];
while(x||!y){z[y++]=x%10+48;x/=10;}
while(y--)putchar(z[y]);
}
inline void writesp(int x){
write(x);putchar(32);
}
inline void writeln(int x){
write(x);putchar(10);
}
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define reprange(a,b,c,d) for(int a=b;a<=c;a+=d)
#define perrange(a,b,c,d) for(int a=b;a>=c;a-=d)
#define graph(i,j,k) for(int i=head[j];i;i=k[i].nxt)
const int maxn=205,maxm=2e4+5;
int n,m,ans;
struct edge{
int to,nxt;
}a[maxm];
int head[maxn],edges;
void add(int x,int y){
a[++edges]=(edge){y,head[x]};
head[x]=edges;
}
int match[maxn],vis[maxn];
bool era[maxn];
bitset<maxn>f[maxn];
namespace Question1{
void floyd(){
rep(i,1,n)rep(j,1,n)if(f[i][j])f[i]|=f[j];
}
bool dfs(int x,int tag){
if(vis[x]==tag||era[x]) return 0;
vis[x]=tag;
graph(i,x,a){
int u=a[i].to;
if(era[u]) continue;
if(!match[u]||dfs(match[u],tag)){
match[u]=x,match[x]=u;
return 1;
}
}
return 0;
}
void solve(){
floyd();
rep(i,1,n){
rep(j,1,n){
if(i==j) continue;
if(f[i][j]) add(i,j+n);
}
}
rep(i,1,n){
if(dfs(i,i)){
ans++;
}
}
ans=n-ans;
writeln(ans);
}
}
namespace Question2{
bool vis1[maxn];
void dfs(int x){
if(vis1[x]) return;
vis1[x]=1;
graph(i,x,a){
int u=a[i].to;
if(vis1[u]) continue;
vis1[u]=1,dfs(match[u]);
}
}
void solve(){
// rep(i,1,n)if(match[i])graph(j,i,a){
// if(a[j].to==match[i]){
// a[j].flag=1;
// break;
// }
// }
rep(i,1,n){
if(!match[i]){
dfs(i);
}
}
rep(i,1,n){
if(vis1[i]&&!vis1[i+n]) putchar('1');
else putchar('0');
}
puts("");
}
}
namespace Question3{
void build(int x){
era[x]=era[x+n]=1;
rep(i,1,n) if(f[x][i]||f[i][x]) era[i]=era[i+n]=1;
}
bool check(int x){
// rep(i,1,n) writesp(era[i]);
memset(match,0,sizeof match);
memset(vis,0,sizeof vis);
memset(era,0,sizeof era);
build(x);
int res=0,cur=0;
rep(i,1,n)if(Question1::dfs(i,i))res++;
rep(i,1,n)if(!era[i])cur++;
// writeln(res);
return cur-res==ans-1;
}
void solve(){
rep(i,1,n){
if(check(i)) putchar('1');
else putchar('0');
}
}
}
using namespace Question1;
using namespace Question2;
using namespace Question3;
int main(){
n=R(),m=R();rep(i,1,m)f[R()][R()]=1;
Question1::solve();
Question2::solve();
Question3::solve();
}