1 条题解
-
1
#include<cstdio> #include<cstdlib> using namespace std; const int SIZE=305; int n,m,x,y,counts,h[SIZE],maxn=-1<<30,id; bool get[SIZE]; int main(){ scanf("%d%d",&n,&m); for(int i=1;i<=n;i++){ scanf("%d",&h[i]); if(h[i]>maxn){ maxn=h[i];id=i; } } for(int i=0;i<m;i++){ scanf("%d%d",&x,&y); if(h[x]>h[y]){ if(get[y]!=true) ++counts; get[y]=true; } if(h[y]>h[x]){ if(get[x]!=true) ++counts; get[x]=true; } } for(int i=1;i<=n;i++) if(get[i]==false){ maxn=i;break; } if(counts<n-1||maxn!=id){ printf("Non\n"); }else{ printf("Oui, j'ai trouve la solution.\n"); printf("%d\n",id); } return 0; }
- 1
信息
- ID
- 394
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 3
- 标签
- 递交数
- 1
- 已通过
- 1
- 上传者