#include <cstdio>usingnamespace std;
int n,m;
int a[100],b[100];
intmain(){
scanf("%d%d",&n,&m);
for (int i =1; i <=n; i++)
a[i]=b[i]=0;
for (int i =1; i <=m; i++){
int x,y;
scanf("%d%d",&x,&y);
if(a[x]<y&&b[y]<x){
if(a[x]>0)
b[a[x]]=0;
if(b[y]>0)
a[b[y]]=0;
a[x]=y;
b[y]=x;
}
}
int ans=0;
for (int i =1; i <=n; i++)
{
if(a[i]==0)
++ans;
if(b[i]==0)
++ans;
}
printf("%d",ans);
}
Time limit: 0
Quiz Summary
0 of 6 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.