buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
#include <stdio.h> #define lop(i, n) for (i = 0; i < n; i++) int main() { int n, m, i; scanf("%d %d", &n, &m); int h[100005]; lop(i, n) { scanf("%d", &h[i]); } int a, b, c[100005] = {0}; lop(i, m) { scanf("%d %d", &a, &b); if (h[a] < h[b]) { c[a] = 1; } else if (h[a] > h[b]) { c[b...
#include <stdio.h> #define lop(i, n) for (i = 1; i <= n; i++) int main() { int n, m, i; scanf("%d %d", &n, &m); int h[100005]; lop(i, n) { scanf("%d", &h[i]); } int a, b, c[100005] = {0}; lop(i, m) { scanf("%d %d", &a, &b); if (h[a] < h[b]) { c[a] = 1; } else if (h[a] > h[b]) { c[...
[["-", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 112, 51, 59]]
0
198
n,m = map(int,input().split()) h = list(map(int,input().split())) check = [True] * n #小さかったらfalseに for i in range(m): print(i) a,b = (map(int,input().split())) if h[a-1] > h[b-1]: check[b-1] = False elif h[a-1] < h[b-1]: # print("i,check",i,check) check[a-1] = False else: ...
n,m = map(int,input().split()) h = list(map(int,input().split())) check = [True] * n #小さかったらfalseに for i in range(m): #print(i) a,b = (map(int,input().split())) if h[a-1] > h[b-1]: check[b-1] = False elif h[a-1] < h[b-1]: # print("i,check",i,check) check[a-1] = False else: ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
143
co = list(map(int,input().split())) N = co[0] M = co[1] h = list(map(int,input().split())) tenbo = [0 for i in range(N)] for i in range(M): load = list(map(int,input().split())) if h[load[0]-1] >= h[load[1]-1]: tenbo[load[1]-1] +=1 elif h[load[0]-1] <= h[load[1]-1]: tenbo[load[0]-1] +=1 ans...
co = list(map(int,input().split())) N = co[0] M = co[1] h = list(map(int,input().split())) tenbo = [0 for i in range(N)] for i in range(M): load = list(map(int,input().split())) if h[load[0]-1] >= h[load[1]-1]: tenbo[load[1]-1] +=1 if h[load[0]-1] <= h[load[1]-1]: tenbo[load[0]-1] +=1 #...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
173
N, M = map(int, input().split()) H = list(map(int, input().split())) ma = [0]*(N+1) cnt = 0 for _ in range(M): a, b = map(int, input().split()) ma[a] = max(ma[a], H[b-1]) ma[b] = max(H[a-1], ma[b]) for i in range(1, N+1): if H[i] > ma[i]: cnt += 1 print(cnt)
N, M = map(int, input().split()) H = list(map(int, input().split())) ma = [0]*(N+1) cnt = 0 for _ in range(M): a, b = map(int, input().split()) ma[a] = max(ma[a], H[b-1]) ma[b] = max(H[a-1], ma[b]) for i in range(1, N+1): if H[i-1] > ma[i]: cnt += 1 print(cnt)
[["+", 0, 57, 15, 666, 0, 206, 206, 657, 17, 33], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 12, 612]]
5
139
# Your code here! n, m = gets.chomp.split(" ").map(&:to_i) h = gets.chomp.split(" ").map(&:to_i) all = Array.new(n,0) p all (0..m).each do a, b = gets.chomp.split(" ").map(&:to_i) if h[a-1] > h[b-1] all[b-1] += 1 elsif h[a-1] == h[b-1] all[a-1] += 1 all[b-1] += 1 else a...
n, m = gets.chomp.split(" ").map(&:to_i) h = gets.chomp.split(" ").map(&:to_i) all = Array.new(n,0) (0..m-1).each do a, b = gets.split(" ").map(&:to_i) if h[a-1] > h[b-1] all[b-1] += 1 elsif h[a-1] == h[b-1] all[a-1] += 1 all[b-1] += 1 else all[a-1] += 1 end end g...
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22], ["+", 0, 652, 486, 739, 0, 475, 444, 738, 17, 33], ["+", 0, 652, 486, 739, 0, 475, 444, 738, 12, 612], ["-", 0, 662, 12, 652, 486, 652, 486, 652, 17, 131], ["-", 0, 662, 12, 652, 486, 652, 486, 652, 735, 22]]
4
163
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline...
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < n; i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define fi first #define se second #define pb push_back template <class T> inline...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
326
N, M = map(int, input().split()) H = list(map(int, input().split)) AB = [list(map(int, input().split)) for _ in range(M)] neighbor_max_heights = [0] * N for i in range(M): a, b = AB[i] neighbor_max_heights[b-1] = max(neighbor_max_heights[b-1], H[a-1]) neighbor_max_heights[a-1] = max(neighbor_max_heights[a...
N, M = map(int, input().split()) H = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(M)] neighbor_max_heights = [0] * N for i in range(M): a, b = AB[i] neighbor_max_heights[b-1] = max(neighbor_max_heights[b-1], H[a-1]) neighbor_max_heights[a-1] = max(neighbor_max_heigh...
[["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
157
n, m = map(int, input().split()) h = [] h = list(map(int, input().split())) ans = [0]*n for i in range(m): a, b = map(int, input().split()) if h[a-1] > h[b-1]: ans[b-1] = 1 if h[a-1] < h[b-1]: ans[a-1] = 1 else: ans[a-1] = 1 ans[b-1] = 1 print(ans.count(0))
n, m = map(int, input().split()) h = [] h = list(map(int, input().split())) ans = [0]*n for i in range(m): a, b = map(int, input().split()) if h[a-1] > h[b-1]: ans[b-1] = 1 elif h[a-1] < h[b-1]: ans[a-1] = 1 else: ans[a-1] = 1 ans[b-1] = 1 print(ans.count(0))
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683]]
5
141
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <...
#include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <memory> #include <numeric> #include <queue> #include <set> #include <...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
213
n,m=[int(_) for _ in input().split()] H=[int(_) for _ in input().split()] Hlist=[(set() for a in range(n))] count=0 for a in range(m): a,b=[int(_) for _ in input().split()] Hlist[a-1].add(b-1) Hlist[b-1].add(a-1) for i,j in enumerate(Hlist): flag=1 for a in j: if H[a]>=H[i]: flag...
n,m=[int(_) for _ in input().split()] H=[int(_) for _ in input().split()] Hlist=[set() for a in range(n)] count=0 for a in range(m): a,b=[int(_) for _ in input().split()] Hlist[a-1].add(b-1) Hlist[b-1].add(a-1) for i,j in enumerate(Hlist): flag=1 for a in j: if H[a]>=H[i]: flag=0...
[["-", 0, 1, 0, 662, 12, 634, 0, 668, 0, 24], ["-", 0, 668, 0, 659, 12, 652, 3, 4, 0, 25]]
5
158
N, M = map(int, input().split()) H = list(map(int, input().split())) preH = [] for i in range(M): preH.append(list(map(int, input().split()))) ans = [True]*N for i in range(M): A,B = preH[i] #一行ずつ処理 if(H[A-1]>=H[B-1]): ans[A-1] = False if(H[B-1]>=H[A-1]): ans[B-1] = False print(ans.c...
N, M = map(int, input().split()) H = list(map(int, input().split())) preH =[] for i in range(M): preH.append(list(map(int, input().split()))) ans = [True]*N for i in range(M): A,B = preH[i] if(H[A-1]<=H[B-1]): ans[A-1] = False if(H[B-1]<=H[A-1]): ans[B-1] = False print(ans.count(True...
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 667, 20], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 667, 19]]
5
148
N,M=map(int, input().split()) yoi = [] for i in range(N): yoi.append(True) H=list(map(int, input().split())) for i in ranage(M): A,B=map(int, input().split()) if H[A-1]<=H[B-1]: yoi[A-1]=False if H[B-1]<=H[A-1]: yoi[B-1]=False print(len([1 for x in yoi if x==True]))
N,M=map(int, input().split()) yoi = [] for i in range(N): yoi.append(True) H=list(map(int, input().split())) for i in range(M): A,B=map(int, input().split()) if H[A-1]<=H[B-1]: yoi[A-1]=False if H[B-1]<=H[A-1]: yoi[B-1]=False print(len([1 for x in yoi if x==True]))
[["-", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22], ["+", 36, 36, 0, 656, 0, 7, 12, 652, 63, 22]]
5
138
N,M = map(int,input().split()) H = list(map(int,input().split())) bridge = [[] for i in range(N+1)] for i in range(M): A,B = map(int,input().split()) bridge[A].append(B) bridge[B].append(A) ans = 0 count = 0 for i in range(1,N+1): tmp = bridge[i] tmp = list(set(tmp)) flag = True for j in...
N,M = map(int,input().split()) H = list(map(int,input().split())) bridge = [[] for i in range(N+1)] for i in range(M): A,B = map(int,input().split()) bridge[A].append(B) bridge[B].append(A) ans = 0 count = 0 for i in range(1,N+1): tmp = bridge[i] tmp = list(set(tmp)) flag = True for j in...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
210
N,M = map(int, input().split()) H=list(map(int, input().split())) h=[1 for _ in range(N)] for i in range(M): A=list(map(int, input().split())) Ah = H[A[0]-1] Bh = H[A[1]-1] if Ah >= Bh: h[A[1]-1]=0 else: h[A[0]-1]=0 print(sum(h))
N,M = map(int, input().split()) H=list(map(int, input().split())) h=[1 for _ in range(N)] for i in range(M): A=list(map(int, input().split())) Ah = H[A[0]-1] Bh = H[A[1]-1] if Ah >= Bh: h[A[1]-1]=0 if Ah <= Bh: h[A[0]-1]=0 print(sum(h))
[["-", 0, 7, 8, 196, 0, 57, 75, 76, 0, 95], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 22], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
128
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < (int)n; i++) #define ll long long int #define py printf("Yes\n") #define pn printf("No\n") #define in cin >> using namespace std; int main() { int n, m, h[n], ma[n]; in n >> m; for (int i = 1; i <= n; i++) { in h[i]; ma[i] = ...
#include <bits/stdc++.h> #include <math.h> #define rep(i, n) for (int i = 0; i < (int)n; i++) #define ll long long int #define py printf("Yes\n") #define pn printf("No\n") #define in cin >> using namespace std; int main() { int n, m, h[100000], ma[100000]; in n >> m; for (int i = 1; i <= n; i++) { in h[i]; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
186
n, m = list(map(int, input().split())) hs = list(map(int, input().split())) ans = [1]*n for i in range(m): road = list(map(int, input().split())) if hs[road[0]-1] <= hs[road[1]-1]: ans[road[0]-1] = 0 if hs[road[0]-1] >= hs[road[1]-1]: ans[road[1]-1] = 0 print(ans.count(0))
n, m = list(map(int, input().split())) hs = list(map(int, input().split())) ans = [1]*n for i in range(m): road = list(map(int, input().split())) if hs[road[0]-1] <= hs[road[1]-1]: ans[road[0]-1] = 0 if hs[road[0]-1] >= hs[road[1]-1]: ans[road[1]-1] = 0 print(ans.count(1))
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
141
n, m = map(int, input().rstrip().split()) h = map(int, input().rstrip().split()) l = [] high = [0] * n count = 0 for i in range(m): a, b = map(int, input().rstrip().split()) l.append([a, b]) for i in l: if h[i[0]-1] < h[i[1]-1]: high[i[0]-1] += 1 elif h[i[0]-1] == h[i[1]-1]: high[i[0]-...
n, m = map(int, input().rstrip().split()) h = list(map(int, input().rstrip().split())) l = [] high = [0] * n count = 0 for i in range(m): a, b = map(int, input().rstrip().split()) l.append([a, b]) for i in l: if h[i[0]-1] < h[i[1]-1]: high[i[0]-1] += 1 elif h[i[0]-1] == h[i[1]-1]: high...
[["+", 0, 656, 0, 1, 0, 662, 12, 652, 63, 22], ["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
200
# -*- coding: utf-8 -*- n, m = list(map(int, input().split())) h = list(map(int, input().split())) to = [[] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 print(a, b) to[a].append(b) to[b].append(a) ans = 0 for i in range(n): ok = True for ...
# -*- coding: utf-8 -*- n, m = list(map(int, input().split())) h = list(map(int, input().split())) to = [[] for i in range(n)] for i in range(m): a, b = list(map(int, input().split())) a -= 1 b -= 1 to[a].append(b) to[b].append(a) ans = 0 for i in range(n): ok = True for j in to[i]: ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
157
from collections import defaultdict d = defaultdict(list) N, M = list(map(int, input().split())) H = list(map(int, input().split())) for i in range(M): a, b = list(map(int, input().split())) d[a-1].append(b-1) d[b-1].append(a-1) ans = 0 for i in range(N): ng = 0 if(i not in d): ans += ...
from collections import defaultdict d = defaultdict(list) N, M = list(map(int, input().split())) H = list(map(int, input().split())) for i in range(M): a, b = list(map(int, input().split())) d[a-1].append(b-1) d[b-1].append(a-1) ans = 0 for i in range(N): ng = 0 if(i not in d): ans += ...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
163
#include <bits/stdc++.h> using namespace std; #define fastIO ios::sync_with_stdio(0), cin.tie(0) #define endl '\n' #define ft first #define sd second typedef long long ll; typedef pair<int, int> pii; int main() { #ifndef LOCAL fastIO; #endif int n, m, a, b, rta = 0; cin >> n >> m; int alturas[n + 1]; alturas...
#include <bits/stdc++.h> using namespace std; #define fastIO ios::sync_with_stdio(0), cin.tie(0) #define endl '\n' #define ft first #define sd second typedef long long ll; typedef pair<int, int> pii; int main() { #ifndef LOCAL fastIO; #endif int n, m, a, b, rta = 0; cin >> n >> m; int alturas[n + 1]; alturas...
[["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 339, 51, 16, 12, 16, 17, 18]]
1
216
N, M = map(int, input().split()) H = list(map(int, input().split())) ma = [0]*N for i in range(M): a, b = map(int, input().split()) ma[a-1] = max(ma[a-1], H[b-1]) ma[b-1] = max(ma[b-1], H[a-1]) ans = 0 for i in range(1, N): if ma[i] < H[i]: ans += 1 print(ans)
N, M = map(int, input().split()) H = list(map(int, input().split())) ma = [0]*N for i in range(M): a, b = map(int, input().split()) ma[a-1] = max(ma[a-1], H[b-1]) ma[b-1] = max(ma[b-1], H[a-1]) ans = 0 for i in range(N): if ma[i] < H[i]: ans += 1 print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 612], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 21]]
5
141
#include <bits/stdc++.h> using namespace std; #define name "" #define ini \ freopen(name ".inp", "r", stdin); \ freopen(name ".out", "w", stdout) #define foe(it, c) for (__typeof(c.begin()) it = c.begin();...
#include <bits/stdc++.h> using namespace std; #define name "" #define ini \ freopen(name ".inp", "r", stdin); \ freopen(name ".out", "w", stdout) #define foe(it, c) for (__typeof(c.begin()) it = c.begin();...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
272
N, M = map(int, input().split()) H = [int(x) for x in input().split()] ifChecked = [0 for _ in range(N)] path = [[] for _ in range(N)] for _ in range(M): A, B = map(int, input().split()) # ここのindexには気をつける path[A-1].append(B) path[B-1].append(A) count = 0 for i in range(1, N+1): # このifCheckはLowestとし...
N, M = map(int, input().split()) H = [int(x) for x in input().split()] ifChecked = [0 for _ in range(N)] path = [[] for _ in range(N)] for _ in range(M): A, B = map(int, input().split()) # ここのindexには気をつける path[A-1].append(B) path[B-1].append(A) count = 0 for i in range(1, N+1): # このifCheckはLowestとし...
[["+", 0, 57, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 57, 64, 196, 0, 1, 0, 677, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
178
n, m = map(int, input().split()) h = list(map(int, input().split())) adj = [[] for i in range(n + 1)] count = 0 def compare_height(adj, h, i): height = h[i - 1] if not adj[i]: return False for j in adj[i]: if h[j - 1] > height: return False return True #adj list for i in ran...
n, m = map(int, input().split()) h = list(map(int, input().split())) adj = [[] for i in range(n + 1)] count = 0 def compare_height(adj, h, i): height = h[i - 1] if not adj[i]: return True for j in adj[i]: if h[j - 1] >= height: return False return True #adj list for i in ran...
[["-", 8, 196, 0, 57, 64, 196, 0, 37, 0, 147], ["+", 8, 196, 0, 57, 64, 196, 0, 37, 0, 146], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
178
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define xx first #define yy second #define vi vector<int> #define pii pair<int, int> #define all(v) v.begin(), v.end() #define MAX 400005 vector<ll> h(MAX), g[MAX]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ...
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define xx first #define yy second #define vi vector<int> #define pii pair<int, int> #define all(v) v.begin(), v.end() #define MAX 400005 vector<ll> h(MAX), g[MAX]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
229
import copy n,m=map(int,input().split()) h=list(map(int,input().split())) l=[] for i in range(m): a,b=map(int,input().split()) l.append([a,b]) ll=[0]*n for j in l: if h[j[0]-1]>h[j[1]-1]: ll[j[1]-1]+=1 elif h[j[0]-1]==h[j[1]-1]: ll[j[1]-1]+=1 ll[j[0]-1]+=1 else: ll...
import copy n,m=map(int,input().split()) h=list(map(int,input().split())) l=[] for i in range(m): a,b=map(int,input().split()) l.append([a,b]) ll=[0]*n for j in l: if h[j[0]-1]>h[j[1]-1]: ll[j[1]-1]+=1 elif h[j[0]-1]==h[j[1]-1]: ll[j[1]-1]+=1 ll[j[0]-1]+=1 else: ll...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 0, 612]]
5
193
## import ## function definition ## main process if __name__ == '__main__': ## input N, M = map(int,input().split()) HEIGHT_LIST = list(map(int,input().split())) ROAD_LIST = [] for j in range(M): ROAD_LIST.append( tuple(map(int,input().split())) ) ## bu...
## import ## function definition ## main process if __name__ == '__main__': ## input N, M = map(int,input().split()) HEIGHT_LIST = list(map(int,input().split())) ROAD_LIST = [] for j in range(M): ROAD_LIST.append( tuple(map(int,input().split())) ) ## bu...
[["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 8, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["+", 0, 7, 8, 196, 0, 1, 0, 677, 17, 110]]
5
177
N,M = list(map(int, input().split())) hights = list(map(int, input().split())) ans = [1]*N for i in range(0,M): a,b = list(map(int, input().split())) if hights[a-1] > hights[b-1]: ans[table[1]] = 0 elif hights[a-1] < hights[b-1]: ans[a-1] = 0 else: ans[a-1] = 0 ans[b-1] = 0 print(sum(ans)) ...
N,M = list(map(int, input().split())) hights = list(map(int, input().split())) ans = [1]*N for i in range(0,M): a,b = list(map(int, input().split())) if hights[a-1] > hights[b-1]: ans[b-1] = 0 elif hights[a-1] < hights[b-1]: ans[a-1] = 0 else: ans[a-1] = 0 ans[b-1] = 0 print(sum(ans))
[["-", 0, 1, 0, 662, 31, 206, 206, 206, 51, 22], ["-", 0, 1, 0, 662, 31, 206, 206, 206, 0, 70], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 662, 31, 206, 206, 206, 0, 73]]
5
144
def make_heights_list(height): return [height, True] tower_len, roads_len = map(int, input().split(' ')) heights = [[0, False]] heights += (list(map(make_heights_list, input().split(' ')))) #print(heights) # 塔を基準にして、その塔ごとに繋がる道をリストアップする roads_highest = list() for i in range(roads_len): start, end = map(int,...
def make_heights_list(height): return [int(height), True] tower_len, roads_len = map(int, input().split(' ')) heights = [[0, False]] heights += (list(map(make_heights_list, input().split(' ')))) #print(heights) # 塔を基準にして、その塔ごとに繋がる道をリストアップする roads_highest = list() for i in range(roads_len): start, end = map...
[["+", 8, 196, 0, 37, 0, 634, 0, 652, 63, 22], ["+", 0, 37, 0, 634, 0, 652, 3, 4, 0, 24], ["+", 0, 37, 0, 634, 0, 652, 3, 4, 0, 25]]
5
192
#include <iostream> using namespace std; #define N 100010 int main() { int n, m, h[N], ma[N]; cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> h[i]; ma[i] = 0; } for (int i = 1; i < n; ++i) { int a, b; cin >> a >> b; ma[a] = max(ma[a], h[b]); ma[b] = max(ma[b], h[a]); } int...
#include <iostream> using namespace std; #define N 100010 int main() { int n, m, h[N], ma[N]; cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> h[i]; ma[i] = 0; } for (int i = 0; i < m; ++i) { int a, b; cin >> a >> b; ma[a] = max(ma[a], h[b]); ma[b] = max(ma[b], h[a]); } int...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
176
N, M= (int(x) for x in input().split()) height=[int(x) for x in input().split()] nlist=[1]*N for _ in range(M): a, b =(int(x) for x in input().split()) a-=1 b-=1 if height[a]<height[b]: nlist[a]=0 if height[b]<height[a]: nlist[b]=0 print(sum(nlist))
N, M= (int(x) for x in input().split()) height=[int(x) for x in input().split()] nlist=[1]*N for _ in range(M): a, b =(int(x) for x in input().split()) a-=1 b-=1 if height[a]<=height[b]: nlist[a]=0 if height[b]<=height[a]: nlist[b]=0 print(sum(nlist))
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
120
i = input() i = i.split(' ') l = [] while len(l)<int(i[0]): l += [0] lim = int(i[1]) i = input() i = i.split(' ') for j in list(range(len(l))): i[j]=int(i[j]) print(i) count=0 while count<lim: count += 1 k = input() k = k.split(' ') if i[int(k[0])-1]==i[int(k[1])-1]: l[int(k[1])-1] = 1 ...
i = input() i = i.split(' ') l = [] while len(l)<int(i[0]): l += [0] lim = int(i[1]) i = input() i = i.split(' ') for j in list(range(len(l))): i[j]=int(i[j]) count=0 while count<lim: count += 1 k = input() k = k.split(' ') if i[int(k[0])-1]==i[int(k[1])-1]: l[int(k[1])-1] = 1 ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
250
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<int> hei(n); for (int i = 1; i <= n; i++) cin >> hei[i]; vector<int> vec[200001]; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<int> hei(n + 1); for (int i = 1; i <= n; i++) cin >> hei[i]; vector<int> vec[200001]; for (int i = 0; i < m; i++) { int x, y; cin >> x >> y;...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
206
n, m = map(int, input().split()) hs = list(map(int, input().split())) ans = [1] * n for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 if hs[a] < hs[b]: ans[a] = 0 elif hs[a] == hs[b]: ans[a] = 0 ans[b] = 0 else: ans[b] == 0 print(sum(ans))
n, m = map(int, input().split()) hs = list(map(int, input().split())) ans = [1] * n for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 if hs[a] < hs[b]: ans[a] = 0 elif hs[a] == hs[b]: ans[a] = 0 ans[b] = 0 else: ans[b] = 0 print(sum(ans))
[["-", 75, 76, 8, 196, 0, 1, 0, 666, 667, 60], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32]]
5
125
N, M = map(int, input().split()) H = [int(x) for x in input().split()] A = [0] * M B = [0] * M F = [0] * N for i in range(M): A[i], B[i] = map(int, input().split()) F[A[i] - 1] = max(F[A[i] - 1], H[B[i] - 1]) F[B[i] - 1] = max(F[B[i] - 1], H[A[i] - 1]) ans = 0 for i in range(N): if F[i] > H[i]: ...
N, M = map(int, input().split()) H = [int(x) for x in input().split()] A = [0] * M B = [0] * M F = [0] * N for i in range(M): A[i], B[i] = map(int, input().split()) F[A[i] - 1] = max(F[A[i] - 1], H[B[i] - 1]) F[B[i] - 1] = max(F[B[i] - 1], H[A[i] - 1]) ans = 0 for i in range(N): if F[i] < H[i]: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
178
N, M =map(int, input().split()) H_tree = [0] + [int(n) for n in input().split()] GOOD_tree = [0] + [1 for n in range(N)] for i in range(M): A, B = map(int, input().split()) if H_tree[A]<=H_tree[B]:GOOD_Tree[A] = 0 if H_tree[A]>=H_tree[B]:GOOD_Tree[B] = 0 print(sum(GOOD_tree))
N, M =map(int, input().split()) H_tree = [0] + [int(n) for n in input().split()] GOOD_tree = [0] + [1 for n in range(N)] for i in range(M): A, B = map(int, input().split()) if H_tree[A]<=H_tree[B]:GOOD_tree[A] = 0 if H_tree[A]>=H_tree[B]:GOOD_tree[B] = 0 print(sum(GOOD_tree))
[["-", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22]]
5
119
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> H(n); for (int &h : H) cin >> h; vector<bool> good(n, true); for (int i = 0; i < m; ++i) { int a, b; cin >> a >> b; --a; --b; if (H[a] <= H[b]) go...
#include <algorithm> #include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> H(n); for (int &h : H) cin >> h; vector<bool> good(n, true); for (int i = 0; i < m; ++i) { int a, b; cin >> a >> b; --a; --b; if (H[a] <= H[b]) go...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
166
n, m = map(int, input().split()) h = list(map(int, input().split())) maxh = [] for height in h: maxh.append(height) for i in range(m): a, b = map(int, input().split()) a, b = a-1, b-1 maxh[a] = max(maxh[a], h[b]) maxh[b] = max(maxh[b], h[a]) g = 0 for height, maxheight in zip(h, maxh): if height...
n, m = map(int, input().split()) h = list(map(int, input().split())) maxh = [] for height in h: maxh.append(0) for i in range(m): a, b = map(int, input().split()) a, b = a-1, b-1 maxh[a] = max(maxh[a], h[b]) maxh[b] = max(maxh[b], h[a]) g = 0 for height, maxheight in zip(h, maxh): if height > ma...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47]]
5
144
n,m = map(int,input().split()) h = list(map(int,input().split())) q = [1]*1 for i in range(m): a,b = map(int,input().split()) if h[a-1] < h[b-1]: q[a-1] = 0 elif h[a-1] > h[b-1]: q[b-1] = 0 else: q[a-1] = 0 q[b-1] = 0 print(q.count(1))
n,m = map(int,input().split()) h = list(map(int,input().split())) q = [1]*n for i in range(m): a,b = map(int,input().split()) if h[a-1] < h[b-1]: q[a-1] = 0 elif h[a-1] > h[b-1]: q[b-1] = 0 else: q[a-1] = 0 q[b-1] = 0 print(q.count(1))
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22]]
5
137
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<vector<int>> v(n + 1); int H[n + 1]{}; for (int i = 1; i <= n; i++) cin >> H[i]; for (int i = 0; i < m; i++) { int u, v1; cin >> u >> v1; v[u].push_back(v1); v[v1].push_back(u); }...
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<vector<int>> v(n + 1); int H[n + 1]{}; for (int i = 1; i <= n; i++) cin >> H[i]; for (int i = 0; i < m; i++) { int u, v1; cin >> u >> v1; v[u].push_back(v1); v[v1].push_back(u); }...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
190
#include <algorithm> #include <bitset> #include <ctype.h> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> ...
#include <algorithm> #include <bitset> #include <ctype.h> #include <deque> #include <iomanip> #include <iostream> #include <iterator> #include <limits> #include <map> #include <math.h> #include <queue> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <vector> ...
[["-", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 52, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
1,387
N,M = map(int,input().split()) H = input().split() good = [1]*N import collections for i in range(M): a,b = map(int,input().split()) if int(H[a-1]) > int(H[b-1]): good[b-1] = 0 elif int(H[a-1]) < int(H[b-1]): good[b-1] = 0 else: good[a-1] = 0 good[b-1] = 0 c = collections.Counter(good) pri...
N,M = map(int,input().split()) H = input().split() good = [1]*N import collections for i in range(M): a,b = map(int,input().split()) if int(H[a-1]) > int(H[b-1]): good[b-1] = 0 elif int(H[a-1]) < int(H[b-1]): good[a-1] = 0 else: good[a-1] = 0 good[b-1] = 0 c = collections.Counter(good) pri...
[["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22]]
5
149
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; vector<int> h(n); vector<bool> ans(n, true); rep(i, n) cin >> h[i]; rep(i, m) { int a, b; cin >> a >> b; a--; b--; if (h[a] == ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n, m; cin >> n >> m; vector<int> h(n); vector<bool> ans(n, true); rep(i, n) cin >> h[i]; rep(i, m) { int a, b; cin >> a >> b; a--; b--; if (h[a] == ...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 60], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 14, 8, 9, 0, 57, 64, 9, 0, 46]]
1
181
n,m = map(int, input().split()) H = list(map(int, input().split())) import collections d = collections.defaultdict(list) for i in range(m): a,b = map(int, input().split()) d[a].append(b-1) d[b].append(a-1) ans = 0 for i in range(n): s = list(set(d[i])) #print('s',s) if len(s) == 0: ans +...
n,m = map(int, input().split()) H = list(map(int, input().split())) import collections d = collections.defaultdict(list) for i in range(m): a,b = map(int, input().split()) d[a-1].append(b-1) d[b-1].append(a-1) ans = 0 for i in range(n): s = list(set(d[i])) #print('l,s', d[i], s) #print('s',s) ...
[["+", 0, 652, 63, 319, 500, 206, 206, 657, 17, 33], ["+", 0, 652, 63, 319, 500, 206, 206, 657, 12, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
171
import numpy as np N, M = map(int, input().split()) H = [int(i) for i in input().split()] X = np.ones(N, np.bool) for _ in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 if H[a] == H[b]: X[a] = X[b] = False elif H[a] < H[b]: X[a] = False else: X[b] = False prin...
import numpy as np N, M = map(int, input().split()) H = [int(i) for i in input().split()] X = np.ones(N, np.bool) for _ in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 if H[a] == H[b]: X[a] = X[b] = False elif H[a] < H[b]: X[a] = False else: X[b] = False prin...
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24]]
5
140
n, m = list(map(int, input().split(" "))) h = list(map(int, input().split(" "))) ans = [1] * n for i in range(m): a, b = list(map(int, input().split(" "))) a,b = a-1,b-1 if h[a] < h[b]: ans[a] = 0 elif h[b] < h[a]: ans[b] = 0 else: ans[a] = 0 ans[b] = 0 print(ans...
n, m = list(map(int, input().split(" "))) h = list(map(int, input().split(" "))) ans = [1] * n for i in range(m): a, b = list(map(int, input().split(" "))) a,b = a-1,b-1 if h[a] < h[b]: ans[a] = 0 elif h[b] < h[a]: ans[b] = 0 else: ans[a] = 0 ans[b] = 0 print(ans...
[["+", 0, 652, 3, 4, 0, 652, 63, 319, 0, 131], ["+", 0, 652, 3, 4, 0, 652, 63, 319, 319, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
142
#include <bits/stdc++.h> #define endl '\n' #define fi first #define se second #define pb push_back #define debug(x) cout << "[debug] " << #x << ": " << x << endl using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef pair<ll, ll> PLL; const int MOD = 1e9 + 7; const int maxn = 1e6 + 5; const int...
#include <bits/stdc++.h> #define endl '\n' #define fi first #define se second #define pb push_back #define debug(x) cout << "[debug] " << #x << ": " << x << endl using namespace std; typedef long long ll; typedef pair<int, int> PII; typedef pair<ll, ll> PLL; const int MOD = 1e9 + 7; const int maxn = 1e6 + 5; const int...
[["-", 0, 1, 0, 16, 31, 16, 12, 16, 17, 85], ["-", 0, 1, 0, 16, 31, 16, 12, 16, 12, 13]]
1
297
n, m = map(int, input().split()) h = list(map(int , input().split())) G = [[] for _ in range(n)] for _ in range(m-1): a, b = map(int, input().split()) G[a-1].append(b-1) G[b-1].append(a-1) #print(G) ans = 0 for i in range(n): maxh = 0 for gi in G[i]: maxh = max(h[gi], maxh) if maxh < h[...
n, m = map(int, input().split()) h = list(map(int , input().split())) G = [[] for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) G[a-1].append(b-1) G[b-1].append(a-1) #print(G) ans = 0 for i in range(n): maxh = 0 for gi in G[i]: maxh = max(h[gi], maxh) if maxh < h[i]...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612]]
5
148
#include <algorithm> #include <cassert> #include <functional> #include <iostream> #include <vector> //#include <bits/stdc++.h> using namespace std; int main() { int N, M; int tmpa, tmpb; cin >> N >> M; // vector<vector<int>> V(100000,vector<int>(100000)); vector<int> H; vector<int> V(100000); int count...
#include <algorithm> #include <cassert> #include <functional> #include <iostream> #include <vector> //#include <bits/stdc++.h> using namespace std; int main() { int N, M; int tmpa, tmpb; cin >> N >> M; // vector<vector<int>> V(100000,vector<int>(100000)); vector<int> H; vector<int> V(100000); int count...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
202
N, M = map(int, input().split(" ")) Hs = list(map(int, input().split(" "))) candidate = set(range(1, N+1)) for _ in range(M): i, j = map(int, input().split(" ")) if Hs[i - 1] >= Hs[j - 1]: # jは良い展望台ではない candidate.discard(j) elif Hs[j - 1] >= Hs[i - 1]: # iは良い展望台ではない candidate...
N, M = map(int, input().split(" ")) Hs = list(map(int, input().split(" "))) candidate = set(range(1, N+1)) for _ in range(M): i, j = map(int, input().split(" ")) if Hs[i - 1] >= Hs[j - 1]: # jは良い展望台ではない candidate.discard(j) if Hs[j - 1] >= Hs[i - 1]: # iは良い展望台ではない candidate.d...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
130
n,m=map(int, input().split()) h=list(map(int, input().split())) arr=[0]*n for i in range(m): a,b=map(int, input().split()) if h[a-1]>h[b-1]: if arr[a-1]!=-1: arr[a-1]=1 arr[b-1]=-1 elif h[a-1]<h[b-1]: if arr[a-1]!=-1: arr[b-1]=1 arr[a-1]=-1 else: ...
n,m=map(int, input().split()) h=list(map(int, input().split())) arr=[0]*n for i in range(m): a,b=map(int, input().split()) if h[a-1]>h[b-1]: if arr[a-1]!=-1: arr[a-1]=1 arr[b-1]=-1 elif h[a-1]<h[b-1]: if arr[b-1]!=-1: arr[b-1]=1 arr[a-1]=-1 else: ...
[["-", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22], ["+", 0, 57, 15, 666, 0, 206, 206, 657, 31, 22]]
5
196
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(v) v.begin(), v.end() #define PRINT(V) \ for (auto v : (V)) \ cout << v << " " const long long INF = 1LL << 60;...
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #define ALL(v) v.begin(), v.end() #define PRINT(V) \ for (auto v : (V)) \ cout << v << " " const long long INF = 1LL << 60;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 33], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
270
#include <stdio.h> int main(void) { int n, m, a, b, ans = 0; scanf("%d %d", &n, &m); int h[n], x[n]; for (int i = 0; i < n; i++) { scanf("%d", &h[i]); x[i] = 0; } for (int i = 0; i < n; i++) { scanf("%d %d", &a, &b); if (h[a - 1] < h[b - 1]) x[a - 1] = 1; else if (h[a - 1] > h[b - ...
#include <stdio.h> int main(void) { int n, m, a, b, ans = 0; scanf("%d %d", &n, &m); int h[n], x[n]; for (int i = 0; i < n; i++) { scanf("%d", &h[i]); x[i] = 0; } for (int i = 0; i < m; i++) { scanf("%d %d", &a, &b); if (h[a - 1] < h[b - 1]) x[a - 1] = 1; else if (h[a - 1] > h[b - ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
0
220
list1=list(map(int,input().strip().split()))[:2] n,m=list1[0],list1[1] arr=list(map(int,input().strip().split()))[:n] dict1={} for i in range(m): l=list(map(int,input().strip().split()))[:2] key,val=l[0],l[1] if key in dict1: dict1[key].append(val) else: dict1[key]=[] dict1[key].append(val) if val in dict1: ...
list1=list(map(int,input().strip().split()))[:2] n,m=list1[0],list1[1] arr=list(map(int,input().strip().split()))[:n] dict1={} for i in range(m): l=list(map(int,input().strip().split()))[:2] key,val=l[0],l[1] if key in dict1: dict1[key].append(val) else: dict1[key]=[] dict1[key].append(val) if val in dict1: ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
250
def main(): NM = list(map(int,input().split())) H = list(map(int,input().split())) # AB = [list(map(int,input().split())) for i in range(NM[1])] Judge = [True] * NM[0] for i in range(NM[1]): ABi = list(map(int,input().split())) if H[ABi[0]-1] > H[ABi[1]-1]: if Judg...
def main(): NM = list(map(int,input().split())) H = list(map(int,input().split())) # AB = [list(map(int,input().split())) for i in range(NM[1])] Judge = [True] * NM[0] for i in range(NM[1]): ABi = list(map(int,input().split())) if H[ABi[0]-1] > H[ABi[1]-1]: if Judg...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 14, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22]]
5
233
N,M = map(int, input().split()) H=list(map(int, input().split())) A=[] B=[] for i in range(M): A1,B1=map(int, input().split()) A.append(A1) B.append(B1) miti={} for i in range(M): if A[i] in miti: miti[A[i]].append(H[B[i]-1]) else: miti[A[i]]=[] miti[A[i]].append(...
N,M = map(int, input().split()) H=list(map(int, input().split())) A=[] B=[] for i in range(M): A1,B1=map(int, input().split()) A.append(A1) B.append(B1) miti={} for i in range(M): if A[i] in miti: miti[A[i]].append(H[B[i]-1]) else: miti[A[i]]=[] miti[A[i]].append(...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
269
def main(): n, m = map(int, input().strip().split()) h = list(map(int, input().strip().split())) flg = [True] * n for i in range(m): a, b = map(int, input().strip().split()) if(h[a-1]<h[b-1]): flg[a-1] = False elif(h[a-1]<h[b-1]): flg[b-1] = False ...
def main(): n, m = map(int, input().strip().split()) h = list(map(int, input().strip().split())) flg = [True] * n for i in range(m): a, b = map(int, input().strip().split()) if(h[a-1]<h[b-1]): flg[a-1] = False elif(h[a-1]>h[b-1]): flg[b-1] = False ...
[["-", 0, 57, 75, 665, 15, 23, 0, 666, 667, 18], ["+", 0, 57, 75, 665, 15, 23, 0, 666, 667, 47]]
5
161
from collections import deque N, M = map(int, input().split()) hight = list(input().split()) hight = [int(hight[i]) for i in range(N)] G = [deque([]) for i in range(N+1)] road = [input().split() for i in range(M)] for i in range(M): G[int(road[i][0])].append(int(road[i][1])) G[int(road[i][1]) - 1].append(...
from collections import deque N, M = map(int, input().split()) hight = list(input().split()) hight = [int(hight[i]) for i in range(N)] G = [deque([]) for i in range(N+1)] road = [input().split() for i in range(M)] for i in range(M): G[int(road[i][0])].append(int(road[i][1])) G[int(road[i][1])].append(int(...
[["-", 0, 652, 63, 319, 500, 206, 206, 657, 17, 33], ["-", 0, 652, 63, 319, 500, 206, 206, 657, 12, 612], ["-", 0, 52, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 52, 8, 196, 0, 57, 15, 666, 667, 20]]
5
226
N, M = map(int, input().split()) H = list(map(int, input().split())) N_addj = [[] for i in range(N)] for i in range(M): AB = list(map(int, input().split())) N_addj[AB[0]-1].append(AB[1]-1) N_addj[AB[1]-1].append(AB[0]-1) N_memo = [0] * N num = 0 arr = [] print(H) for i in range(N): flag = Tru...
N, M = map(int, input().split()) H = list(map(int, input().split())) N_addj = [[] for i in range(N)] for i in range(M): AB = list(map(int, input().split())) N_addj[AB[0]-1].append(AB[1]-1) N_addj[AB[1]-1].append(AB[0]-1) N_memo = [0] * N num = 0 arr = [] for i in range(N): flag = True for ...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
177
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(m), b(m); vector<int> ma(n); vector<int> h(n); int ans = 0; for (int i = 0; i < n; i++) { cin >> h[i];...
#include <algorithm> #include <cmath> #include <iostream> #include <map> #include <queue> #include <string> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(m), b(m); vector<int> ma(n); vector<int> h(n); int ans = 0; for (int i = 0; i < n; i++) { cin >> h[i];...
[["-", 0, 69, 341, 342, 0, 16, 31, 69, 28, 22], ["+", 0, 69, 341, 342, 0, 16, 31, 69, 28, 22]]
1
317
N , M = map(int,input().split()) h = list(map(int, input().split())) graph = [[] for _ in range(N)] for _ in range(M): a , b = map(int,input().split()) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) ans=0 for index,i in enumerate(graph): judge=1 for j in i: if h[index] < h[j]: ...
N , M = map(int,input().split()) h = list(map(int, input().split())) graph = [[] for _ in range(N)] for _ in range(M): a , b = map(int,input().split()) graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) ans=0 for index,i in enumerate(graph): judge=1 for j in i: if h[index] <= h[j]: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
144
n,m = map(int,input().split()) ans = [1]*n h = input().split() h_int = [int(s) for s in h] cou = 0 for i in range(m): x,y = map(int,input().split()) if h_int[x-1] >= h_int[y-1]: ans[y-1] = 0 elif h_int[y-1] >= h_int[x-1]: ans[x-1] = 0 for i in range(n): if ans[i] == 1: cou += 1 print(cou)
n,m = map(int,input().split()) ans = [1]*n h = input().split() h_int = [int(s) for s in h] cou = 0 for i in range(m): x,y = map(int,input().split()) if h_int[x-1] >= h_int[y-1]: ans[y-1] = 0 if h_int[y-1] >= h_int[x-1]: ans[x-1] = 0 for i in range(n): if ans[i] == 1: cou += 1 print(cou)
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
140
#include <bits/stdc++.h> using namespace std; int main() { int N, M, kazu = 0; cin >> N >> M; int ga = -1, ha = -1; vector<long long> h(N + 10); vector<bool> takai(N + 1); for (int i = 1; i <= N; i++) cin >> h.at(i); for (int i = 1; i <= N; i++) takai.at(i) = true; for (int i = 0; i < M;...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, kazu = 0; cin >> N >> M; int ga = -1, ha = -1; vector<long long> h(N + 10); vector<bool> takai(N + 1); for (int i = 1; i <= N; i++) cin >> h.at(i); for (int i = 1; i <= N; i++) takai.at(i) = true; for (int i = 0; i < M;...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
241
def solve(): N,M = map(int, input().split()) H = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(M)] graph = [[] for _1 in range(N)] for a,b in AB: graph[a-1].append(b) graph[b-1].append(a) ans = 0 for i in range(N): height = H[i...
def solve(): N,M = map(int, input().split()) H = list(map(int, input().split())) AB = [list(map(int, input().split())) for _ in range(M)] graph = [[] for _1 in range(N)] for a,b in AB: graph[a-1].append(b) graph[b-1].append(a) ans = 0 #print(graph) for i in range(N): ...
[["-", 0, 1, 0, 662, 12, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 662, 12, 206, 206, 657, 12, 612]]
5
163
N,M=map(int,input().split()) H=list(map(int,input().split())) A,B=[0]*M,[0]*M for i in range(M): A[i],B[i]=map(int,input().split()) lst=[1]*N for i in range(M): if H[A[i]-1]<H[B[i]-1]: lst[A[i]-1]=0 if H[A[i]-1]>H[B[i]-1]: lst[B[i]-1]=0 print(sum(lst))
N,M=map(int,input().split()) H=list(map(int,input().split())) A,B=[0]*M,[0]*M for i in range(M): A[i],B[i]=map(int,input().split()) lst=[1]*N for i in range(M): if H[A[i]-1]<=H[B[i]-1]: lst[A[i]-1]=0 if H[A[i]-1]>=H[B[i]-1]: lst[B[i]-1]=0 print(sum(lst))
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
164
n,m = map(int,input().split()) height = list(map(int,input().split())) # print(height) bridge = [[] for i in range(n)] for i in range(m): a,b = map(int,input().split()) bridge[a-1].append(b-1) bridge[b-1].append(a-1) # print(bridge) good = [None for i in range(n)] # print(good) flag = True for i in range(n): fla...
n,m = map(int,input().split()) height = list(map(int,input().split())) # print(height) bridge = [[] for i in range(n)] for i in range(m): a,b = map(int,input().split()) bridge[a-1].append(b-1) bridge[b-1].append(a-1) # print(bridge) good = [None for i in range(n)] # print(good) flag = True for i in range(n): fla...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
206
package main import ( "fmt" "bufio" "os" ) //FOR I/O : STARTS var Reader *bufio.Reader = bufio.NewReader(os.Stdin) var Writer *bufio.Writer = bufio.NewWriter(os.Stdout) func Printf (f string, a ...interface{}) { fmt.Fprintf(Writer, f, a...) } func Scanf (f string, a ...interface{}) { fmt.Fscanf(Reader, f,...
package main import ( "fmt" "bufio" "os" ) //FOR I/O : STARTS var Reader *bufio.Reader = bufio.NewReader(os.Stdin) var Writer *bufio.Writer = bufio.NewWriter(os.Stdout) func Printf (f string, a ...interface{}) { fmt.Fprintf(Writer, f, a...) } func Scanf (f string, a ...interface{}) { fmt.Fscanf(Reader, f,...
[["-", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117], ["-", 0, 7, 8, 196, 0, 57, 64, 196, 0, 165], ["-", 0, 7, 8, 196, 0, 57, 15, 16, 17, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 16, 17, 19], ["+", 0, 57, 75, 196, 0, 57, 15, 91, 17, 111]]
7
527
#include <algorithm> #include <cmath> #include <fstream> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; #defi...
#include <algorithm> #include <cmath> #include <fstream> #include <iostream> #include <map> #include <numeric> #include <queue> #include <random> #include <set> #include <sstream> #include <stack> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <string> #include <vector> using namespace std; #defi...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 0, 57, 15, 339, 51, 16, 12, 69, 28, 22], ["+", 15, 339, 51, 16, 12, 69, 341, 342, 0, 70], ["+", 12, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
482
#include <bits/stdc++.h> using namespace std; #define pb push_back // var int n, m, t1, t2, h[100001], ans = 0; vector<int> e[100001]; bool g; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> h[i]; for (int i = 1; i <= n; i++) { cin >> t1 >> t2; e[t1].pb(t2); e[t2].pb(t1); } ...
#include <bits/stdc++.h> using namespace std; #define pb push_back // var int n, m, t1, t2, h[100001], ans = 0; vector<int> e[100001]; bool g; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) cin >> h[i]; for (int i = 1; i <= m; i++) { cin >> t1 >> t2; e[t1].pb(t2); e[t2].pb(t1); } ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
174
N, M = map(int, input().split()) H = list(map(int, input().split())) A = [0]*M B = [0]*M for i in range(M): A[i], B[i] = map(int, input().split()) A[i] -= 1 B[i] -= 1 lis = [0]*N for i in range(M): if H[A[i]] >= H[B[i]]: lis[B[i]] = 1 if H[A[i]] <= H[B[i]]: lis[A[i]] = 1 pr...
N, M = map(int, input().split()) H = list(map(int, input().split())) A = [0]*M B = [0]*M for i in range(M): A[i], B[i] = map(int, input().split()) A[i] -= 1 B[i] -= 1 lis = [0]*N for i in range(M): if H[A[i]] >= H[B[i]]: lis[B[i]] = -1 if H[A[i]] <= H[B[i]]: lis[A[i]] = -1 ...
[["+", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33]]
5
165
#include <iostream> using namespace std; int n, m; int H[100000]; int d[100000] = {0}; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { d[i] = 0; cin >> H[i]; } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; d[a - 1] = max(d[a - 1], H[b - 1]); d[b - 1] = max(d[b - 1]...
#include <iostream> using namespace std; int n, m; int H[100000]; int d[100000] = {0}; int main() { cin >> n >> m; for (int i = 0; i < n; i++) { d[i] = 0; cin >> H[i]; } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; d[a - 1] = max(d[a - 1], H[b - 1]); d[b - 1] = max(d[b - 1]...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
189
#include <algorithm> #include <cmath> #include <iomanip> //doubleの桁数指定 setprecision() #include <iostream> #include <list> //前後に数値を入れれる配列 #include <map> //map #include <string> //文字列 #include <vector> //vecror #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) // forの短縮 #define rep(i, n) REP(i, 0, n) ...
#include <algorithm> #include <cmath> #include <iomanip> //doubleの桁数指定 setprecision() #include <iostream> #include <list> //前後に数値を入れれる配列 #include <map> //map #include <string> //文字列 #include <vector> //vecror #define REP(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++) // forの短縮 #define rep(i, n) REP(i, 0, n) ...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]]
1
227
N,M = map(int,input().split()) listH = list(map(int,input().split())) LofS = [set() for i in range(N) ] for i in range(M): a,b=map(int,input().split()) LofS[a-1].add(b) LofS[b-1].add(a) listMax = [] for i in range(N): listMax.append( max( [ listH[j-1] for j in LofS[i] ] , default=0) ) print(listMax) count = 0 ...
N,M = map(int,input().split()) listH = list(map(int,input().split())) LofS = [set() for i in range(N) ] for i in range(M): a,b=map(int,input().split()) LofS[a-1].add(b) LofS[b-1].add(a) listMax = [] for i in range(N): listMax.append( max( [ listH[j-1] for j in LofS[i] ] , default=0) ) count = 0 for i in range(...
[["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25]]
5
165
#include <cmath> #include <iostream> #include <stdio.h> #include <string> using namespace std; int main(void) { int n, m; int h[100000]; int a[100000]; int b[100000]; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; } bool mem...
#include <cmath> #include <iostream> #include <stdio.h> #include <string> using namespace std; int main(void) { int n, m; int h[100000]; int a[100000]; int b[100000]; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; } bool mem...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
256
def main(): n,m = map(int,input().split()) h = list(map(int,input().split())) A = [0] * n for i in range(m): a,b = map(int,input().split()) A[a-1] = max(A[a-1],h[b-1]) A[b-1] = max(A[b-1],h[a-1]) cnt = 0 for i in range(n): if A[i] > h[i]: cnt += 1 ...
def main(): n,m = map(int,input().split()) h = list(map(int,input().split())) A = [0] * n for i in range(m): a,b = map(int,input().split()) A[a-1] = max(A[a-1],h[b-1]) A[b-1] = max(A[b-1],h[a-1]) cnt = 0 for i in range(n): if A[i] < h[i]: cnt += 1 ...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
154
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace __gnu_cxx; using namespace std; using ll = long long; #define eb emplace_back #define pb push_back #define mp make_pair #define ff first #define ss sec...
#include "bits/stdc++.h" #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> using namespace __gnu_pbds; using namespace __gnu_cxx; using namespace std; using ll = long long; #define eb emplace_back #define pb push_back #define mp make_pair #define ff first #define ss sec...
[["-", 8, 9, 0, 7, 15, 16, 12, 16, 31, 22], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 17, 33], ["-", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
538
N, M = map(int, input().split()) H = [int(h) for h in input().split()] Max = [h-1 for h in H] for _ in range(M): ab = [int(_ab)-1 for _ab in input().split()] Max[ab[0]] = max(Max[ab[0]], Max[ab[1]]) Max[ab[1]] = max(Max[ab[0]], Max[ab[1]]) cnt = 0 for n in range(N): if H[n] > Max[n]: cnt += 1 ...
N, M = map(int, input().split()) H = [int(h) for h in input().split()] Max = [h-1 for h in H] for _ in range(M): ab = [int(_ab)-1 for _ab in input().split()] Max[ab[0]] = max(Max[ab[0]], H[ab[1]]) Max[ab[1]] = max(H[ab[0]], Max[ab[1]]) cnt = 0 for n in range(N): if H[n] > Max[n]: cnt += 1 prin...
[["-", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22]]
5
154
#include <stdio.h> const int maxn = 1e5 + 5; int a[maxn]; int can[maxn]; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); can[i] = 1; } for (int i = 1; i <= m; i++) { int u, v; scanf("%d%d", &u, &v); if (a[u] >= a[v]) can[v] = 0; ...
#include <stdio.h> const int maxn = 1e5 + 5; int a[maxn]; int can[maxn]; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); can[i] = 1; } for (int i = 1; i <= m; i++) { int u, v; scanf("%d%d", &u, &v); if (a[u] >= a[v]) can[v] = 0; ...
[["-", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 64, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
196
import numpy as np N,M = [int(i) for i in input().split(" ")] H = [int(i) for i in input().split(" ")] mh = np.zeros([N]) for i in range(M): a,b = [int(i)-1 for i in input().split(" ")] mh[a] = max(mh[a],h[b]) mh[b] = max(mh[b],h[a]) ans = 0 for i in range(N): if mh[i] < h[i]: ans += 1 print(...
import numpy as np N,M = [int(i) for i in input().split(" ")] H = [int(i) for i in input().split(" ")] mh = np.zeros([N]) for i in range(M): a,b = [int(i)-1 for i in input().split(" ")] mh[a] = max(mh[a],H[b]) mh[b] = max(mh[b],H[a]) ans = 0 for i in range(N): if mh[i] < H[i]: ans += 1 print(...
[["-", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22], ["+", 0, 662, 12, 652, 3, 4, 0, 206, 51, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22]]
5
154
int1 = lambda x: int(x) - 1 N, M = map(int, input().split()) H = list(map(int, input().split())) nei = [[] for _ in range(N)] for _ in range(M): A, B = map(int1, input().split()) nei[A].append(B) nei[B].append(A) good = [True] * N for i in range(N): if good[i]: for n in nei[i]: i...
int1 = lambda x: int(x) - 1 N, M = map(int, input().split()) H = list(map(int, input().split())) nei = [[] for _ in range(N)] for _ in range(M): A, B = map(int1, input().split()) nei[A].append(B) nei[B].append(A) good = [True] * N for i in range(N): if good[i]: for n in nei[i]: i...
[["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 70], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 0, 73]]
5
158
from heapq import heappush, heappop def main(): N, M = [int(v) for v in input().split()] H = [int(v) for v in input().split()] link = [0] * N for _ in range(M): a, b = [int(v) - 1 for v in input().split()] link[a] = max(link[a], H[b]) link[b] = max(link[b], H[a]) count ...
from heapq import heappush, heappop def main(): N, M = [int(v) for v in input().split()] H = [int(v) for v in input().split()] link = [0] * N for _ in range(M): a, b = [int(v) - 1 for v in input().split()] link[a] = max(link[a], H[b]) link[b] = max(link[b], H[a]) count ...
[["-", 0, 7, 8, 196, 0, 1, 0, 652, 63, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 21], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
156
# C N, M = map(int, input().split()) H = list(map(int, input().split())) A = [0] * N for i in range(M): a, b = map(int, input().split()) A[a-1] = max(A[a-1], H[b-1]) A[b-1] = max(A[b-1], H[a-1]) res = sum([H[i] >= A[i] for i in range(N)]) print(res)
# C N, M = map(int, input().split()) H = list(map(int, input().split())) A = [0] * N for i in range(M): a, b = map(int, input().split()) A[a-1] = max(A[a-1], H[b-1]) A[b-1] = max(A[b-1], H[a-1]) res = sum([H[i] > A[i] for i in range(N)]) print(res)
[["-", 12, 652, 3, 4, 0, 658, 8, 666, 667, 20], ["+", 12, 652, 3, 4, 0, 658, 8, 666, 667, 47]]
5
138
n,m = map(int,input().split()) H = list(map(int,input().split())) p = [0]*n for i in range(m): a,b = map(int,input().split()) if H[a-1] >= H[b-1]: H[b-1] = -1 if H[a-1] <= H[b-1]: H[a-1] = -1 print(p.count(0))
n,m = map(int,input().split()) H = list(map(int,input().split())) p = [0]*n for i in range(m): a,b = map(int,input().split()) if H[a-1] >= H[b-1]: p[b-1] = -1 if H[a-1] <= H[b-1]: p[a-1] = -1 print(p.count(0))
[["-", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22]]
5
121
i = list(map(int, input().split())) j = list(map(int, input().split())) lis=[] ans = 0 for a in range (i[0]): tendata=[a+1,j[a],0] lis.append(tendata) for b in range(i[1]): miti = list(map(int, input().split())) if ((lis[miti[0]-1][1]) > (lis[miti[1]-1][1])): lis[miti[1]-1][2] = 1 ...
i = list(map(int, input().split())) j = list(map(int, input().split())) lis=[] ans = 0 for a in range (i[0]): tendata=[a+1,j[a],0] lis.append(tendata) for b in range(i[1]): miti = list(map(int, input().split())) if ((lis[miti[0]-1][1]) > (lis[miti[1]-1][1])): lis[miti[1]-1][2] = 1 ...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25]]
5
253
n,m=map(int, input().split()) h = list(map(int, input().split())) l = [input().split() for i in range(m)] list = [0]*n for j in range(m): if h[int(l[j][0])-1] > h[int(l[j][1])-1]: list[int(l[j][1])-1] -= 1 elif h[int(l[j][0])-1] < h[int(l[j][1])-1]: list[int(l[j][0])-1] -= 1 else : ...
n,m=map(int, input().split()) h = list(map(int, input().split())) l = [input().split() for i in range(m)] list = [0]*n for j in range(m): if h[int(l[j][0])-1] > h[int(l[j][1])-1]: list[int(l[j][1])-1] -= 1 elif h[int(l[j][0])-1] < h[int(l[j][1])-1]: list[int(l[j][0])-1] -= 1 else : ...
[["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 36, 36, 0, 656, 0, 1, 0, 652, 63, 22], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 652, 3, 4, 0, 652, 63, 319, 500, 22]]
5
215
#include <bits/stdc++.h> using namespace std; #define S scanf #define P printf #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #defi...
#include <bits/stdc++.h> using namespace std; #define S scanf #define P printf #define G getline #define SZ size() #define C clear() #define B begin() #define F front() #define T top() #define E end() #define EM empty() #define V vector #define Q queue #define DQ deque #define PQ priority_queue #define ST stack #defi...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 338, 8, 9, 0, 57, 75, 76, 0, 95]]
1
338
n,m = map(int, input().split()) h = list(map(int, input().split())) n = [i for i in range(n)] for i in range(m): a,b = map(int, input().split()) if h[a-1] > h[b-1]: n[b-1]=0 elif h[a-1]<h[b-1]: n[a-1]=0 else: n[a-1]=0 n[b-1]=0 print(sum(n))
n,m = map(int, input().split()) h = list(map(int, input().split())) n = [1 for i in range(n)] for i in range(m): a,b = map(int, input().split()) if h[a-1] > h[b-1]: n[b-1]=0 elif h[a-1]<h[b-1]: n[a-1]=0 else: n[a-1]=0 n[b-1]=0 print(sum(n))
[["-", 0, 656, 0, 1, 0, 662, 12, 658, 8, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 658, 8, 612]]
5
140
n,m = list(map(int,input().split() )) h = list(map(int,input().split() )) # 要素n が全てTrueの配列 good = [True] * n for im in range(m): a,b = list(map(int,input().split())) if h[a-1] > h[b-1]: good[b] = False elif h[b-1] > h[a-1]: good[a-1] = False else: good[a-1] = False good...
n,m = list(map(int,input().split())) h = list(map(int,input().split())) # 要素n が全てTrueの配列 good = [True] * n for im in range(m): a,b = list(map(int,input().split())) if h[a-1] > h[b-1]: good[b-1] = False elif h[b-1] > h[a-1]: good[a-1] = False else: good[a-1] = False good...
[["+", 0, 1, 0, 662, 31, 206, 206, 657, 17, 33], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 12, 612]]
5
143
N, M = map(int,input().split()) H = list(map(int, input().split())) arr = [list(map(int, input().split())) for i in range(M)] highest_tenbo = [0 for i in range(N)] for a, b in arr: highest_tenbo[a-1] = max(highest_tenbo[a-1], H[b-1]) highest_tenbo[b-1] = max(highest_tenbo[b-1], H[a-1]) ans = 0 for i, t in en...
N, M = map(int,input().split()) H = list(map(int, input().split())) arr = [list(map(int, input().split())) for i in range(M)] highest_tenbo = [0 for i in range(N)] for a, b in arr: highest_tenbo[a-1] = max(highest_tenbo[a-1], H[b-1]) highest_tenbo[b-1] = max(highest_tenbo[b-1], H[a-1]) ans = 0 for i, t in enu...
[["-", 0, 7, 8, 196, 0, 57, 15, 681, 0, 372]]
5
153
#include <bits/stdc++.h> using namespace std; using namespace std; #define ll long long #define f(i, a, b) for (ll i = a; i < b; i++) #define endl '\n' #define spc " " #define pb push_back #define mp make_pair #define mod 1000000007 vector<vector<ll>> vii; int main() { ios::sync_with_stdio(0); cin.tie(0); // ...
#include <bits/stdc++.h> using namespace std; using namespace std; #define ll long long #define f(i, a, b) for (ll i = a; i < b; i++) #define endl '\n' #define spc " " #define pb push_back #define mp make_pair #define mod 1000000007 vector<vector<ll>> vii; int main() { ios::sync_with_stdio(0); cin.tie(0); // ...
[["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 1, 0, 27, 28, 22], ["+", 0, 57, 75, 76, 0, 1, 0, 27, 17, 29], ["+", 0, 9, 0, 57, 75, 76, 0, 1, 0, 35]]
1
258
#include <iostream> #include <vector> using namespace std; int main() { int n, m, a, b, ans = 0; cin >> n >> m; vector<bool> z(n, true); vector<int> h(n); for (auto &i : h) { cin >> i; } for (int i = 0; i < m; i++) { cin >> a >> b; if (h[a - 1] == h[b - 1]) { z[a - 1] = false; z[b ...
#include <iostream> #include <vector> using namespace std; int main() { int n, m, a, b, ans = 0; cin >> n >> m; vector<bool> z(n, true); vector<int> h(n); for (auto &i : h) { cin >> i; } for (int i = 0; i < m; i++) { cin >> a >> b; if (h[a - 1] == h[b - 1]) { z[a - 1] = false; z[b ...
[["-", 0, 11, 31, 69, 341, 342, 0, 16, 12, 22], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
189
import bisect import collections import sys sys.setrecursionlimit(100000) input = sys.stdin.readline ACMOD = 1000000007 INF = 1 << 62 def lmi(): return list(map(int, input().split())) def llmi(n): return [lmi() for _ in range(n)] N, M = lmi() H = lmi() AB = llmi(M) flag = [1] * N for a, b in AB: a =...
import bisect import collections import sys sys.setrecursionlimit(100000) input = sys.stdin.readline ACMOD = 1000000007 INF = 1 << 62 def lmi(): return list(map(int, input().split())) def llmi(n): return [lmi() for _ in range(n)] N, M = lmi() H = lmi() AB = llmi(M) flag = [1] * N for a, b in AB: a =...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
150
# -*- coding: utf-8 -*- N,M = map(int, input().split()) h_l = list(map(int, input().split())) all_l = list(range(1,N+1)) lose_l = [] while M > 0: a,b = map(int, input().split()) if h_l[a-1] > h_l[b-1]: lose_l.append(b) if h_l[a-1] < h_l[b-1]: lose_l.append(a) else: lose_l.appen...
# -*- coding: utf-8 -*- N,M = map(int, input().split()) h_l = list(map(int, input().split())) all_l = list(range(1,N+1)) lose_l = [] while M > 0: a,b = map(int, input().split()) if h_l[a-1] > h_l[b-1]: lose_l.append(b) elif h_l[a-1] < h_l[b-1]: lose_l.append(a) else: lose_l.app...
[["-", 0, 656, 0, 52, 8, 196, 0, 57, 0, 121], ["+", 0, 52, 8, 196, 0, 57, 75, 665, 0, 683], ["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
152
# -*- coding: utf-8 -*- def main(): N,M = map(int, input().split()) H = list(map(int, input().split())) ans = [] for _ in range(N): ans.append(1) for i in range(M): A,B = map(int, input().split()) if H[A-1] < H[B-1]: ans[A-1] = -1 elif H[A-1] > H[B-1]: ...
# -*- coding: utf-8 -*- def main(): N,M = map(int, input().split()) H = list(map(int, input().split())) ans = [] for _ in range(N): ans.append(1) for i in range(M): A,B = map(int, input().split()) if H[A-1] < H[B-1]: ans[A-1] = 0 elif H[A-1] > H[B-1]: ...
[["-", 64, 196, 0, 1, 0, 662, 12, 664, 17, 33], ["-", 64, 196, 0, 1, 0, 662, 12, 664, 28, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
163
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
#include <bits/stdc++.h> #define rep(i, a, b) for (ll i = ll(a); i < ll(b); i++) #define irep(i, a, b) for (ll i = ll(a); i >= ll(b); i--) template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { ...
[["-", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22], ["+", 0, 52, 15, 339, 51, 16, 31, 16, 12, 22]]
1
483
n, m = map(int, input().split()) h = list(map(int, input().split())) l = [list(map(int, input().split())) for _ in range(m)] # create graph g = [] for i in range(n): g.append(set()) for i in range(m): g[l[i][0]-1].add(l[i][1]-1) g[l[i][1]-1].add(l[i][0]-1) ans = 0 # seach for i in range(n): if len(g[i...
n, m = map(int, input().split()) h = list(map(int, input().split())) l = [list(map(int, input().split())) for _ in range(m)] # create graph g = [] for i in range(n): g.append(set()) for i in range(m): g[l[i][0]-1].add(l[i][1]-1) g[l[i][1]-1].add(l[i][0]-1) # search ans = 0 for i in range(n): if len(g...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
221
n, m = list(map(int, input().split())) H = list(map(int, input().split())) ab = [list(map(int, input().split())) for i in range(m)] ans = [1] * (n) route = [1] * (n) for i in range(len(ab)): a, b = ab[i] if H[a-1] <= H[b-1]: ans[a-1] = 0 elif H[b-1] <= H[a-1]: ans[b-1] = 0 print(sum(ans))
n, m = list(map(int, input().split())) H = list(map(int, input().split())) ab = [list(map(int, input().split())) for i in range(m)] ans = [1] * (n) route = [1] * (n) for i in range(len(ab)): a, b = ab[i] if H[a-1] <= H[b-1]: ans[a-1] = 0 if H[b-1] <= H[a-1]: ans[b-1] = 0 print(sum(ans))
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
152
n,m = map(int,input().split()) h = list(map(int, input().split())) s = [1]*len(h) A = [] B = [] for i in range(m): a, b = input().split() A.append(int(a)) B.append(int(b)) for j in range(m): if h[A[j]-1] > h[B[j]-1]: s[B[j]-1] = 0 elif h[A[i]-1] < h[B[j]-1]: s[A[j]-1] = 0...
n,m = map(int,input().split()) h = list(map(int, input().split())) s = [1]*len(h) A = [] B = [] for i in range(m): a, b = input().split() A.append(int(a)) B.append(int(b)) for j in range(m): if h[A[j]-1] > h[B[j]-1]: s[B[j]-1] = 0 elif h[A[j]-1] < h[B[j]-1]: s[A[j]-1] = 0...
[["-", 15, 666, 0, 206, 206, 657, 31, 206, 206, 22], ["+", 15, 666, 0, 206, 206, 657, 31, 206, 206, 22]]
5
210
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n + 1); vector<int> adj[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } int ans = ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> a(n + 1); vector<int> adj[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } int ans = ...
[["+", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46], ["-", 0, 7, 8, 9, 0, 7, 8, 9, 0, 46]]
1
201
N, M = map(int, input().split()) H = list(map(int, input().split())) A = [] B = [] for i in range(M): a, b = (map(int, input().split())) A.append(a) B.append(b) flg = [1] * N for i in range(M): if flg[A[i]-1] == 1 and H[A[i]-1] < H[B[i]-1]: flg[A[i]-1] = 0 for i in range(M): if flg[B[i]-1] == 1 and H[A[...
N, M = map(int, input().split()) H = list(map(int, input().split())) A = [] B = [] for i in range(M): a, b = (map(int, input().split())) A.append(a) B.append(b) flg = [1] * N for i in range(M): if flg[A[i]-1] == 1 and H[A[i]-1] <= H[B[i]-1]: flg[A[i]-1] = 0 for i in range(M): if flg[B[i]-1] == 1 and H[A...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 19], ["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 47], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 20]]
5
197