Topic Portal
1 /*2 violence: Violence too, no words. No-map, both sides of the point to add degrees and points3 */4#include <cstdio>5#include <algorithm>6#include <cstring>7#include <vector>8#include <cmath>9 using namespacestd;Ten OnetypedefLong Longll; A Const intMAXN = 2e2 +Ten; - Const intINF =0x3f3f3f3f; - ll A[MAXN]; thevector<int>G[MAXN]; - intDEGREE[MAXN]; - - intMainvoid)//Hihocoder 1179 Timeless Games + { - //freopen ("c.in", "R", stdin); + A intN, M; at while(SCANF ("%d%d", &n, &m) = =2) - { - for(intI=0; i<n; ++i) scanf ("%lld", &a[i]); - for(intI=0; i<n; ++i) g[i].clear (); -memset (Degree,0,sizeof(degree)); - while(m--) in { - intU, v; scanf ("%d%d", &u, &v); todegree[u]++; degree[v]++; + G[u].push_back (v); G[v].push_back (u); - } the * BOOLOK =false; $ for(intI=1; i<=100001; ++i)Panax Notoginseng { -OK =false; the for(intj=0; j<n; ++j) + { A if(A[j] >=Degree[j]) the { + for(intk=0; K<g[j].size (); ++k) - { $a[j]--; a[g[j][k]]++; $ } -OK =true; Break; - } the } - if(!ok) {printf ("%d\n"I1); Break;}Wuyi } the if(OK) puts ("INF"); - } Wu - return 0; About}
Violence/graph theory Hihocoder 1179 Timeless games