2019-2020 ICPC, NERC, Southern and Volga Russian Regional Contest 11/14
A#include#includeusingnamespacestd;intconstN=100005;inta[N],dfn[N];intmx[N],mi[N];voidupdate(intx){mx[x]=max(mx[x],dfn[x]);mi[x]=min(mi[x],dfn[x]);}intmain(){intn,m;scanf("%d%d",&n,&m);for(inti=1;i#de