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 <bits/stdc++.h> using namespace std; using ll = long long int; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define REP3(i, x, n) for (int i = x; i > (n); i--) #define zero_pad(num) setfill('0') << std::right << setw(num) #define space_pad(num) setfill(' '...
#include <bits/stdc++.h> using namespace std; using ll = long long int; #define REP(i, n) for (int i = 0; i < (n); i++) #define REP2(i, x, n) for (int i = x; i < (n); i++) #define REP3(i, x, n) for (int i = x; i > (n); i--) #define zero_pad(num) setfill('0') << std::right << setw(num) #define space_pad(num) setfill(' '...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13]]
1
258
#include <bits/stdc++.h> using namespace std; int main() { int N, M, a, b; cin >> N >> M; map<int, int> high; vector<int> vec; for (int i = 0; i < N; i++) { cin >> high[i]; } for (int i = 0; i < M; i++) { cin >> a >> b; if (high[a] > high[b]) vec.push_back(b); else if (high[a] < hig...
#include <bits/stdc++.h> using namespace std; int main() { int N, M, a, b; cin >> N >> M; map<int, int> high; vector<int> vec; for (int i = 1; i <= N; i++) { cin >> high[i]; } for (int i = 0; i < M; i++) { cin >> a >> b; if (high[a] > high[b]) vec.push_back(b); else if (high[a] < h...
[["-", 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, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
197
n,m = map(int,input().split()) h = list(map(int,input().split())) p = [0 for i in range(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))
n,m = map(int,input().split()) h = list(map(int,input().split())) p = [0 for i in range(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))
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
126
N,M = input().split() N = int(N) M = int(M) o_height = input().split() result = [] for i in range(N): result.append(True) while(M): road = input().split() if int(o_height[int(road[0])-1]) < int(o_height[int(road[1])-1]): result[int(road[0])-1] = False elif int(o_height[int(road[0])-1]) < int(o...
N,M = input().split() N = int(N) M = int(M) o_height = input().split() result = [] for i in range(N): result.append(True) while(M): road = input().split() if int(o_height[int(road[0])-1]) < int(o_height[int(road[1])-1]): result[int(road[0])-1] = False elif int(o_height[int(road[0])-1]) == int(...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 60]]
5
220
n, m = map(int, input().split()) h = list(input().split()) l = [1] * n for i in range(0, int(m)): a, b = map(int, input().split()) a_int = int(h[int(a)-1]) b_int = int(h[int(b)-1]) if (a_int < b_int): l[a - 1] = 0 if (a_int > b_int): l[b - 1] = 0 if (l[ a- 1] == 0): ...
n, m = map(int, input().split()) h = list(input().split()) l = [1] * n for i in range(0, int(m)): a, b = map(int, input().split()) a_int = int(h[int(a)-1]) b_int = int(h[int(b)-1]) if (a_int < b_int): l[a - 1] = 0 if (a_int > b_int): l[b - 1] = 0 if (l[a-1] == 1): ...
[["-", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["+", 8, 196, 0, 57, 15, 23, 0, 666, 0, 612], ["-", 0, 57, 75, 665, 15, 23, 0, 666, 0, 612], ["+", 0, 57, 75, 665, 15, 23, 0, 666, 0, 612]]
5
225
#include <bits/stdc++.h> using namespace std; int h[100005]; bool huai[100005]; int main() { int m, n; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; if (h[a] == h[b]) huai[a] = huai[b] = true; if (h[a] > h[b]) ...
#include <bits/stdc++.h> using namespace std; int h[100005]; bool huai[100005]; int main() { int m, n; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; if (h[a] == h[b]) huai[a] = huai[b] = true; if (h[a] > h[b]) ...
[["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 62], ["-", 0, 16, 31, 16, 31, 16, 12, 5, 0, 6], ["-", 8, 9, 0, 1, 0, 16, 31, 16, 17, 151]]
1
182
#include <iostream> using namespace std; int main() { long long int n, m, h[100005], a[100001], b[100001]; bool bb[100001]; cin >> n >> m; long long int ans = n; for (int i = 1; i < n + 1; i++) { cin >> h[i]; bb[i] = true; } for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; if (h[a[i]] ==...
#include <iostream> using namespace std; int main() { long long int n, m, h[100005], a[100001], b[100001]; bool bb[100005]; cin >> n >> m; long long int ans = n; for (int i = 1; i < n + 1; i++) { cin >> h[i]; bb[i] = true; } for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; if (h[a[i]] =...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 51, 16, 31, 69, 341, 342, 0, 69, 28, 22], ["+", 51, 16, 31, 69, 341, 342, 0, 69, 28, 22]]
1
296
#include <iostream> #include <vector> int main() { int n; std::cin >> n; int m; std::cin >> m; std::vector<int> h(n); for (int i = 0; i < n; ++i) { int v; std::cin >> v; h[i] = v; } std::vector<int> r(n); for (int i = 0; i < m; ++i) { int a; std::cin >> a; --a; int b;...
#include <iostream> #include <vector> int main() { int n; std::cin >> n; int m; std::cin >> m; std::vector<int> h(n); for (int i = 0; i < n; ++i) { int v; std::cin >> v; h[i] = v; } std::vector<int> r(n); for (int i = 0; i < m; ++i) { int a; std::cin >> a; --a; int b;...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
206
#!/usr/bin/env python3 n, m = map(int, input().split()) *h, = map(int, input().split()) h = [0] + h i = [0] + [1] * n for j in range(m): a, b = map(int, input().split()) if h[a] >= h[b]: i[b] = 0 elif h[a] <= h[b]: i[a] = 0 print(sum(i))
#!/usr/bin/env python3 n, m = map(int, input().split()) *h, = map(int, input().split()) h = [0] + h i = [0] + [1] * n for j in range(m): a, b = map(int, input().split()) if h[a] >= h[b]: i[b] = 0 if h[a] <= h[b]: i[a] = 0 print(sum(i))
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
116
N, M = map(int, input().split()) ListH = list(map(int, input().split())) ListAB = [list(map(int, input().split())) for i in range(M)] Cnt=[0]*N for i in range(M): if ListH[ListAB[i][0]-1]==ListH[ListAB[i][1]-1]: Cnt[ListAB[i][0]-1] = 1 Cnt[ListAB[i][1]-1] = 1 else : if ListH[ListAB[i][0]-1] > ListH[...
N, M = map(int, input().split()) ListH = list(map(int, input().split())) ListAB = [list(map(int, input().split())) for i in range(M)] Cnt=[0]*N for i in range(M): if ListH[ListAB[i][0]-1]==ListH[ListAB[i][1]-1]: Cnt[ListAB[i][0]-1] = 1 Cnt[ListAB[i][1]-1] = 1 else : if ListH[ListAB[i][0]-1] > ListH[...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
222
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long ll; int main...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; typedef long long ll; int main...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 106], ["+", 0, 57, 15, 339, 51, 16, 12, 91, 17, 111]]
1
235
N,M = map(int,input().split()) H = [0] H.extend(list(map(int,input().split()))) R = [[] for _ in range(N+1)] for i in range(M): a,b = map(int,input().split()) R[a].append(b) R[b].append(a) ans = N # print(H) # print(R) for i in range(1,N+1): for j in R[i]: if H[i] < H[j]: ans = ans - 1 break...
N,M = map(int,input().split()) H = [0] H.extend(list(map(int,input().split()))) R = [[] for _ in range(N+1)] for i in range(M): a,b = map(int,input().split()) R[a].append(b) R[b].append(a) ans = N # print(H) # print(R) for i in range(1,N+1): for j in R[i]: if H[i] <= H[j]: ans = ans - 1 brea...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
144
n, m = gets.strip.split.map(&:to_i) h = gets.strip.split.map(&:to_i) r = Array.new(n,1) m.times do a, b = gets.strip.split.map{|v| v.to_i-1} d = h[a]-h[b] r[a] = 0 if d <= 0 r[b] = 0 if d >= 0 end p r-[0].size
n, m = gets.strip.split.map(&:to_i) h = gets.strip.split.map(&:to_i) r = Array.new(n,1) m.times do a, b = gets.strip.split.map{|v| v.to_i-1} d = h[a]-h[b] r[a] = 0 if d <= 0 r[b] = 0 if d >= 0 end p (r-[0]).size
[["+", 0, 652, 3, 4, 0, 652, 486, 739, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 486, 739, 0, 25]]
4
103
n,m = map(int,input().split()) h = list(map(int,input().split())) H = set(range(n)) print(h) for i in range(m): a,b = map(int,input().split()) if h[a-1] <= h[b-1]: H.discard(a-1) if h[a-1] >= h[b-1]: H.discard(b-1) print(len(H))
n,m = map(int,input().split()) h = list(map(int,input().split())) H = set(range(n)) for i in range(m): a,b = map(int,input().split()) if h[a-1] <= h[b-1]: H.discard(a-1) if h[a-1] >= h[b-1]: H.discard(b-1) print(len(H))
[["-", 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
123
N, M = list(map(int, input().split())) H_list = list(map(int, input().split())) road_list = [] for _ in range(M): road_list.append([]) for i in range(M): a, b = list(map(int, input().split())) H_a, H_b = [H_list[a - 1], H_list[b - 1]] if H_a <= H_b: road_list[a - 1].append(a) elif H_b <= H_...
N, M = list(map(int, input().split())) H_list = list(map(int, input().split())) road_list = [] for _ in range(N): road_list.append([]) for i in range(M): a, b = list(map(int, input().split())) H_a, H_b = [H_list[a - 1], H_list[b - 1]] if H_a <= H_b: road_list[a - 1].append(b) ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
156
import collections n,m = (int(i) for i in input().split()) h = [int(i) for i in input().split()] ab =[[0]]*n print(ab) for _ in range(m): a,b = (int(i) for i in input().split()) if h[a-1]-h[b-1]>0: ab[b-1]=["a"] elif h[a-1]-h[b-1]<0: ab[a-1]=["a"] else: ab[a-1]=["a"] ab[b-1]=["a"] print(ab.count([0]))
import collections n,m = (int(i) for i in input().split()) h = [int(i) for i in input().split()] ab =[[0]]*n for _ in range(m): a,b = (int(i) for i in input().split()) if h[a-1]-h[b-1]>0: ab[b-1]=["a"] elif h[a-1]-h[b-1]<0: ab[a-1]=["a"] else: ab[a-1]=["a"] ab[b-1]=["a"] print(ab.count([0]))
[["-", 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
176
number_of_observatory, number_of_road = map(int, input().split()) height_list = [0] # 1始まりで合わせるため height_list.extend(list(map(int, input().split()))) road_list = [] for i in range(number_of_road): li = list(map(int, input().split())) road_list.append(li) # start・end の順に格納 counta = 0 not_good_list = [] # 良い展...
number_of_observatory, number_of_road = map(int, input().split()) height_list = [0] # 1始まりで合わせるため height_list.extend(list(map(int, input().split()))) road_list = [] for i in range(number_of_road): li = list(map(int, input().split())) road_list.append(li) # start・end の順に格納 counta = 0 not_good_list = [] # 良い展...
[["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
177
#include <iostream> #include <set> using namespace std; #define N_MAX 100000 int H[N_MAX + 1], root[N_MAX + 1][2]; set<int> st; set<int> er; set<int> num; int main() { int N, M; cin >> N >> M; for (int i = 1; i <= N; i++) { cin >> H[i]; num.insert(i); } for (int i = 1; i <= M; i++) { cin >> ro...
#include <iostream> #include <set> using namespace std; #define N_MAX 100000 int H[N_MAX + 1], root[N_MAX + 1][2]; set<int> st; set<int> er; set<int> num; int main() { int N, M; cin >> N >> M; for (int i = 1; i <= N; i++) { cin >> H[i]; num.insert(i); } for (int i = 1; i <= M; i++) { cin >> ro...
[["-", 64, 9, 0, 1, 0, 2, 63, 118, 28, 22], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 28, 22]]
1
351
#include <bits/stdc++.h> using namespace std; int main() { int n, m; vector<int> H, A, B, ans; int count = 0; cin >> n >> m; H.assign(n + 1, 0); ans.assign(n + 1, 1); A.assign(m + 1, 0); B.assign(m + 1, 0); for (int i = 1; i <= n; i++) { cin >> H.at(i); } for (int i = 1; i <= m; i++) { ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; vector<int> H, A, B, ans; int count = 0; cin >> n >> m; H.assign(n + 1, 0); ans.assign(n + 1, 1); A.assign(m + 1, 0); B.assign(m + 1, 0); for (int i = 1; i <= n; i++) { cin >> H.at(i); } for (int i = 1; i <= m; i++) { ...
[["-", 0, 7, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 7, 8, 9, 0, 1, 0, 16, 17, 151], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 107]]
1
258
h, m =map(int,input().strip().split()) height=list(map(int,input().strip().split()) ) lst=[1]*h for i in range(m): a,b=map(int,input().strip().split()) if height[a-1]>height[b-1]: lst[b-1]=0 elif height[a-1]<height[b-1]: lst[a-1]=0 else: lst[b - 1] = 0 lst[a - 1] = 0 pr...
h, m =map(int,input().strip().split()) height=list(map(int,input().strip().split()) ) lst=[1]*h for i in range(m): a,b=map(int,input().strip().split()) if height[a-1]>height[b-1]: lst[b-1]=0 elif height[a-1]<height[b-1]: lst[a-1]=0 else: lst[b - 1] = 0 lst[a - 1] = 0 p...
[["-", 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
153
N , M = map(int,input().split()) Height = [h_i for h_i in map(int,input().split())] Roots = [] counter = [0 for i in range(N)] for j in range(M): root = [c_i -1 for c_i in map(int,input().split())] #print(root) if Height[root[0]]<Height[root[1]]: counter[root[0]] += 1 elif Height[root[0]]==Heigh...
N , M = map(int,input().split()) Height = [h_i for h_i in map(int,input().split())] Roots = [] counter = [0 for i in range(N)] for j in range(M): root = [c_i -1 for c_i in map(int,input().split())] #print(root) if Height[root[0]]<Height[root[1]]: counter[root[0]] += 1 elif Height[root[0]]==Heigh...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 79], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60]]
5
181
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (long long int i = 0; i < (n); i++) using namespace std; int main(int argc, char *argv[]) { long long int N, M; cin >> N >> M; ...
#include <algorithm> #include <cstdio> #include <iostream> #include <math.h> #include <queue> #include <set> #include <string> #include <tuple> #include <vector> #define rep(i, n) for (long long int i = 0; i < (n); i++) using namespace std; int main(int argc, char *argv[]) { long long int N, M; cin >> N >> M; ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
219
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m, x, y; cin >> n >> m; vector<int> v(n + 1); for (int i = 1; i <= n; i++) cin >> v[i]; map<int, vector<int>> mp; for (int i = 1; i < n; i++) mp[i].push_back(-1); for (int ...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m, x, y; cin >> n >> m; vector<int> v(n + 1); for (int i = 1; i <= n; i++) cin >> v[i]; map<int, vector<int>> mp; for (int i = 1; i <= n; i++) mp[i].push_back(-1); for (int...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
283
n,m = map(int,input().split()) h = tuple(map(int,input().split())) l = set([tuple(map(int,input().split())) for i in range(m)]) x = [[] for i in range(n)] ans=0 for t in l: x[t[0]-1].append(h[t[1]-1]) x[t[1]-1].append(h[t[0]-1]) for k,li in enumerate(x): a = h[k] if li == []: pass else: ...
n,m = map(int,input().split()) h = tuple(map(int,input().split())) l = set([tuple(map(int,input().split())) for i in range(m)]) x = [[] for i in range(n)] ans=0 for t in l: x[t[0]-1].append(h[t[1]-1]) x[t[1]-1].append(h[t[0]-1]) for k,li in enumerate(x): a = h[k] if li == []: ans+=1 else: ...
[["-", 8, 196, 0, 57, 64, 196, 0, 674, 0, 675], ["+", 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], ["-", 75, 76, 8, 196, 0, 57, 15, 666, 667, 20], ["+", 75, 76, 8, 196, 0, 57, 15, 666, 667, 47]]
5
167
n,m = map(int,input().split()) h = list(map(int,input().split())) g = [1]*n for i in range(m): a,b = map(int,input().split()) if h[a-1] >= h[b-1]: g[b-1] = 0 elif h[b-1] >= h[a-1]: g[a-1] = 0 print(sum(g))
n,m = map(int,input().split()) h = list(map(int,input().split())) g = [1]*n for i in range(m): a,b = map(int,input().split()) if h[a-1] >= h[b-1]: g[b-1] = 0 if h[b-1] >= h[a-1]: g[a-1] = 0 print(sum(g))
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
117
N,M=map(int,input().split()) H=list(map(int,input().split())) #tenbo=[x for x in range(1,N+1)] tenbo=[1]*N ABlist=[] count=N for i in range(M): A,B=map(int,input().split()) if H[A-1]<H[B-1]: tenbo[A-1]=0 elif H[B-1]<H[A-1]: tenbo[B-1]=0 elif H[A-1]==H[B-1]: tenbo[A-1]=H[B-1]=0 #print(tenbo) print(t...
N,M=map(int,input().split()) H=list(map(int,input().split())) #tenbo=[x for x in range(1,N+1)] tenbo=[1]*N ABlist=[] count=N for i in range(M): A,B=map(int,input().split()) if H[A-1]<H[B-1]: tenbo[A-1]=0 elif H[B-1]<H[A-1]: tenbo[B-1]=0 elif H[A-1]==H[B-1]: tenbo[A-1]=tenbo[B-1]=0 #print(tenbo) pri...
[["-", 0, 1, 0, 662, 12, 662, 31, 206, 51, 22], ["+", 0, 1, 0, 662, 12, 662, 31, 206, 51, 22]]
5
158
#include <bits/stdc++.h> #include <cmath> #include <cstdlib> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const ll INF = 1e18; const ll mod = 2019; inline void chmax(ll &a, ll b) { a = max(a, b); } inline void chmin(ll &a, ll b) { a = min(a, b); } ...
#include <bits/stdc++.h> #include <cmath> #include <cstdlib> #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair<int, int>; const ll INF = 1e18; const ll mod = 2019; inline void chmax(ll &a, ll b) { a = max(a, b); } inline void chmin(ll &a, ll b) { a = min(a, b); } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
294
n, m = map(int, input().split()) h = list(map(int, input().split())) l = [[] for _ in range(n)] ans = 0 for _ in range(m): a, b = map(int, input().split()) l[a-1].append(h[b-1]) l[b-1].append(h[a-1]) for i in range(n): s = h[i] x = l[i] print(i) if len(x) == 0: ans += 1 ...
n, m = map(int, input().split()) h = list(map(int, input().split())) l = [[] for _ in range(n)] ans = 0 for _ in range(m): a, b = map(int, input().split()) l[a-1].append(h[b-1]) l[b-1].append(h[a-1]) for i in range(n): s = h[i] x = l[i] if len(x) == 0: ans += 1 continue ...
[["-", 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
156
a,b = map(int, input().split()) List = [list(map(int, input().split())) for i in range(b+1)] #i番目の展望台の高さ List[0][i-1](i>=1) Flag=[1]*a for i in range(1,b+1): m = List[i][0]-1 # 比較する展望台の番号 n = List[i][1]-1 # 比較する展望台の番号 if List[0][m] < List[0][n]: Flag[m]=0 elif List[0][n] < List[0][m]: Flag[n]=0 elif L...
a,b = map(int, input().split()) List = [list(map(int, input().split())) for i in range(b+1)] #i番目の展望台の高さ List[0][i-1](i>=1) Flag=[1]*a for i in range(1,b+1): m = List[i][0]-1 # 比較する展望台の番号 n = List[i][1]-1 # 比較する展望台の番号 if List[0][m] < List[0][n]: Flag[m]=0 elif List[0][n] < List[0][m]: Flag[n]=0 elif L...
[["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 0, 73], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 0, 70]]
5
177
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()) cnt = 0 lose_flag = [0] * n for j in range(m): if h[a[j]-1] < h[b[j]-1]: lose_flag[a[j]-1] = 1 elif h[a[j]-1] > h[b[j]-1]: lose_flag[b[j]-1...
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()) cnt = 0 lose_flag = [0] * n for j in range(m): if h[a[j]-1] < h[b[j]-1]: lose_flag[a[j]-1] = 1 elif h[a[j]-1] > h[b[j]-1]: lose_flag[b[j]-1...
[["-", 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
218
#include <cstdio> using namespace std; bool vis[100005]; int h[100005], n, m, a, b, c; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) { scanf("%d", h + i); } for (int i = 1; i <= m; ++i) { scanf("%d%d", &a, &b); if (h[a] > h[b]) vis[b] = true; else if (h[a] < h[b]) ...
#include <cstdio> using namespace std; bool vis[100005]; int h[100005], n, m, a, b, c; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; ++i) { scanf("%d", h + i); } for (int i = 1; i <= m; ++i) { scanf("%d%d", &a, &b); if (h[a] >= h[b]) vis[b] = true; if (h[a] <= h[b]) vis...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
184
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [list(map(int, input().split())) for i in range(m)] res = [1]*n for el in ab: if h[el[0]-1] >= h[el[1]-1] : res[el[1]-1] = 0 elif h[el[0]-1] <= h[el[1]-1] : res[el[0]-1] = 0 print(sum(res))
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [list(map(int, input().split())) for i in range(m)] res = [1]*n for el in ab: if h[el[0]-1] >= h[el[1]-1] : res[el[1]-1] = 0 if h[el[0]-1] <= h[el[1]-1] : res[el[0]-1] = 0 print(sum(res))
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
142
#include <stdio.h> #define N 100000 int main() { int n, m, c; long int h[N]; int i; int good[N]; int u, v, f; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) { scanf("%ld", &h[i]); good[i] = 1; //いい展望台flag } for (i = 0; i < m; i++) { scanf("%d %d", &u, &v); u--; v--; if (h[u...
#include <stdio.h> #define N 100000 int main() { int n, m, c; long int h[N]; int i; int good[N]; int u, v, f; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) { scanf("%ld", &h[i]); good[i] = 1; //いい展望台flag } for (i = 0; i < m; i++) { scanf("%d %d", &u, &v); u--; v--; if (h[u...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["-", 0, 7, 8, 57, 15, 23, 0, 91, 17, 111]]
0
213
#include <algorithm> #include <iostream> const int N = 1e5 + 5; using namespace std; int h[N], s[N]; int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < k; i++) { int a, b; cin >> a >> b; if (h[a] < h[b]) s[a] = 1; else if (h[a] > h[b]) ...
#include <algorithm> #include <iostream> const int N = 1e5 + 5; using namespace std; int h[N], s[N]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) cin >> h[i]; for (int i = 0; i < k; i++) { int a, b; cin >> a >> b; if (h[a] < h[b]) s[a] = 1; else if (h[a] > h[b]) ...
[["-", 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, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
186
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int *h = new int[n]; int *h2 = new int[n]{}; int *a = new int[m]; int *b = new int[m]; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; a[i]--; b[i]--; } for (int...
#include <iostream> using namespace std; int main() { int n, m; cin >> n >> m; int *h = new int[n]; int *h2 = new int[n]{}; int *a = new int[m]; int *b = new int[m]; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; a[i]--; b[i]--; } for (int...
[["-", 0, 1, 0, 11, 12, 11, 31, 69, 28, 22], ["+", 0, 1, 0, 11, 12, 11, 31, 69, 28, 22]]
1
284
n, m = (int(i) for i in input().split()) h = list(map(int,input().split())) A = [] B = [] for i in range(m): a, b = (int(i) for i in input().split()) A.append(a) B.append(b) x = [True]*n for i in range(m): if(h[A[i]-1] >= h[B[i]-1]): x[B[i]-1] = False elif(h[A[i]-1] <= h[B[i]-1]): ...
n, m = (int(i) for i in input().split()) h = list(map(int,input().split())) A = [] B = [] for i in range(m): a, b = (int(i) for i in input().split()) A.append(a) B.append(b) x = [True]*n for i in range(m): if(h[A[i]-1] >= h[B[i]-1]): x[B[i]-1] = False if(h[A[i]-1] <= h[B[i]-1]): x[...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
188
n, m = [int(i) for i in input().split()] h = [int(i) for i in input().split()] t = h[::1] for i in range(m): a, b = [int(i) for i in input().split()] if h[a-1] > h[b-1]: t[b-1] = 0 if h[a-1] < h[b-1]: t[a-1] = 0 else: t[a-1] = 0 t[b-1] = 0 ans = 0 for i in t: if i !=...
n, m = [int(i) for i in input().split()] h = [int(i) for i in input().split()] t = h[::1] for i in range(m): a, b = [int(i) for i in input().split()] if h[a-1] > h[b-1]: t[b-1] = 0 elif h[a-1] < h[b-1]: t[a-1] = 0 else: t[a-1] = 0 t[b-1] = 0 ans = 0 for i in t: if i ...
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683]]
5
158
N,M = map(int, input().split()) print(M) Hs = list(map(int, input().split())) i = 0 ABs = [] while True: if M <= i: break ABs.append(list(map(int, input().split()))) i += 1 r = [0] * N for A, B in ABs: if Hs[A-1] <= Hs[B-1]: r[A-1] = -1 if Hs[B-1] <= Hs[A-1]: r[B-1] = -1 print(r.count(0))
N,M = map(int, input().split()) Hs = list(map(int, input().split())) i = 0 ABs = [] while True: if M <= i: break ABs.append(list(map(int, input().split()))) i += 1 r = [0] * N for A, B in ABs: if Hs[A-1] <= Hs[B-1]: r[A-1] = -1 if Hs[B-1] <= Hs[A-1]: r[B-1] = -1 print(r.count(0))
[["-", 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
147
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll n, m; cin >> n >> m; vector<ll> vec(n + 1, 0); for (ll i = 1; i <= n; i++) { cin >> vec[i]; } vector<vector<ll>> vec2(n + 1); map<ll, ll> map; for (ll i = 1; i <= m; i++) { ll u, v; cin >> u >> v; vec2...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll n, m; cin >> n >> m; vector<ll> vec(n + 1, 0); for (ll i = 1; i <= n; i++) { cin >> vec[i]; } vector<vector<ll>> vec2(n + 1); map<ll, ll> map; for (ll i = 1; i <= m; i++) { ll u, v; cin >> u >> v; vec2...
[["+", 0, 1, 0, 2, 3, 4, 0, 69, 28, 22], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 70], ["+", 0, 2, 3, 4, 0, 69, 341, 342, 0, 73]]
1
250
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 if H[A-1]<H[B-1]: n[A-1]=0 else: n[A-1],n[B-1]=0,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, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["-", 8, 196, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 432, 0, 612], ["-", 8, 196, 0, 1, 0, 662, 12, 432, 0, 21]]
5
141
#include <algorithm> #include <cmath> #include <cstring> #include <fstream> #include <iostream> #include <string> using namespace std; int main() { int N, M; cin >> N >> M; int *H = new int[N + 1]; for (int i = 1; i <= N; i++) cin >> H[i]; int *good = new int[N + 1]; for (int i = 1; i <= N; i++) { ...
#include <algorithm> #include <cmath> #include <cstring> #include <fstream> #include <iostream> #include <string> using namespace std; int main() { int N, M; cin >> N >> M; int *H = new int[N + 1]; for (int i = 1; i <= N; i++) cin >> H[i]; int *good = new int[N + 1]; for (int i = 1; i <= N; i++) { ...
[["-", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22], ["+", 0, 1, 0, 11, 31, 69, 341, 342, 0, 22]]
1
220
N, M = map(int, input().split()) high = list(map(int, input().split())) road = [list(map(int, input().split())) for i in range(M)] p=[True for _ in range(N)] for i in road: if high[i[0]-1]<=high[i[1]-1] and p[i[0]-1]==True: p[i[0]-1]=False elif high[i[0]-1]>=high[i[1]-1] and p[i[1]-1]==True: ...
N, M = map(int, input().split()) high = list(map(int, input().split())) road = [list(map(int, input().split())) for i in range(M)] p=[True for _ in range(N)] for i in road: if high[i[0]-1]<=high[i[1]-1] and p[i[0]-1]==True: p[i[0]-1]=False if high[i[0]-1]>=high[i[1]-1] and p[i[1]-1]==True: ...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
173
#include <algorithm> #include <cmath> #include <iostream> #include <string> #define f first #define s second using namespace std; typedef long long ll; const ll limit = 1e6 + 2; const ll maxN = 1e9 + 2; string s, st, st1; bool f[limit]; long long t, n, x, test, tp = 0, mp = 0, temp = 0, l, r, m, res = 0, k; long long b...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #define f first #define s second using namespace std; typedef long long ll; const ll limit = 1e6 + 2; const ll maxN = 1e9 + 2; string s, st, st1; bool f[limit]; long long t, n, x, test, tp = 0, mp = 0, temp = 0, l, r, m, res = 0, k; long long b...
[["-", 0, 57, 15, 339, 51, 16, 31, 16, 17, 79], ["-", 0, 57, 15, 339, 51, 16, 31, 16, 12, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 98], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 31, 22], ["-", 0, 57, 15, 339, 51, 16, 12, 16, 17, 19], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18]]
1
294
n, m = map(int, input().split()) h = list(map(int, input().split())) a = list() b = list() for x in range(0, m): A, B = map(int, input().split()) a.append(A) b.append(B) check = [0]*n for x, y in zip(a, b): if check[x-1] != 1: if h[x-1] > h[y-1]: check[x-1] = 1 else: ...
n, m = map(int, input().split()) h = list(map(int, input().split())) a = list() b = list() for x in range(0, m): A, B = map(int, input().split()) a.append(A) b.append(B) check = [0]*n for x, y in zip(a, b): if check[x-1] != -1: if h[x-1] > h[y-1]: check[x-1] = 1 else: ...
[["+", 8, 196, 0, 57, 15, 666, 0, 664, 17, 33]]
5
209
N, M = map(int, input().split()) height = input().split() area = [[] for i in range(N)] for i in range(M): road = input().split() for place in road: area[int(road[0])-1].append(int(height[int(road[1])-1])) area[int(road[1])-1].append(int(height[int(road[0])-1])) counter = 0 for i in range(N): ...
N, M = map(int, input().split()) height = input().split() area = [[] for i in range(N)] for i in range(M): road = input().split() for place in road: area[int(road[0])-1].append(int(height[int(road[1])-1])) area[int(road[1])-1].append(int(height[int(road[0])-1])) counter = 0 for i in range(N): ...
[["-", 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
175
n,m = list(map(int,input().strip().split())) h = list(map(int,input().split())) temp = [1] * n ans = int(0) for i in range(m): a,b = list(map(int,input().strip().split())) if h[a-1] > h[b-1]: temp[b-1] *= 0 elif h[a-1] == h[b-i]: temp[a-1] *= 0 temp[b-1] *= 0 else: temp[a...
n,m = list(map(int,input().strip().split())) h = list(map(int,input().split())) temp = [1] * n ans = int(0) for i in range(m): a,b = list(map(int,input().strip().split())) if h[a-1] > h[b-1]: temp[b-1] *= 0 elif h[a-1] == h[b-1]: temp[a-1] *= 0 temp[b-1] *= 0 else: temp[a...
[["-", 75, 665, 15, 666, 0, 206, 206, 657, 12, 22], ["+", 75, 665, 15, 666, 0, 206, 206, 657, 12, 612]]
5
160
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_) l = [1] * N for i in range(M): if H[A[i]-1] >= H[B[i]-1]: l[B[i]-1] = 0 if H[A[i]-1] <= H[B[i]-1]: l[B[i]-1] = 0 print(s...
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_) l = [1] * N for i in range(M): if H[A[i]-1] >= H[B[i]-1]: l[B[i]-1] = 0 if H[A[i]-1] <= H[B[i]-1]: l[A[i]-1] = 0 print(s...
[["-", 0, 662, 31, 206, 206, 657, 31, 206, 51, 22], ["+", 0, 662, 31, 206, 206, 657, 31, 206, 51, 22]]
5
163
N, M = map(int, input().split()) H = list(map(int, input().split())) L = [0]*N for i in range(N): L[i] = [1] print(L) for i in range(M): A, B = map(int, input().split()) if H[A-1] > H[B-1]: L[B-1].append(0) elif H[A-1] < H[B-1]: L[A-1].append(0) else: L[A-1].append(0) ...
N, M = map(int, input().split()) H = list(map(int, input().split())) L = [0]*N for i in range(N): L[i] = [1] for i in range(M): A, B = map(int, input().split()) if H[A-1] > H[B-1]: L[B-1].append(0) elif H[A-1] < H[B-1]: L[A-1].append(0) else: L[A-1].append(0) L[B-1].a...
[["-", 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
196
N, M = map(int, input().split()) H = list(map(int, input().split())) lst = [] for i in range(M): A, B = map(int, input().split()) lst.append([A,B]) r = [0]*N for i, j in lst: i -= 1 j -= 1 if H[i] >= H[j] and r[i] >= 0: r[i] = H[i] r[j] = -1 if H[j] >= H[i] and r[j] >= 0: ...
N, M = map(int, input().split()) H = list(map(int, input().split())) lst = [] for i in range(M): A, B = map(int, input().split()) lst.append([A,B]) r = [0]*N for i, j in lst: i -= 1 j -= 1 if H[i] >= H[j]: if r[i] >= 0: r[i] = H[i] r[j] = -1 if H[j] >= H[i]: ...
[["-", 0, 7, 8, 196, 0, 57, 15, 679, 17, 355], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 102], ["+", 8, 196, 0, 57, 64, 196, 0, 57, 0, 121]]
5
179
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, m; int h[maxn], a, b; vector<int> con[maxn]; int main() { int res = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { scanf("%d", &h[i]); } for (int i = 1; i <= m; i++) { scanf("%d%d", &a, &b); con[a].push_back(b); ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int n, m; int h[maxn], a, b; vector<int> con[maxn]; int main() { int res = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { scanf("%d", &h[i]); } for (int i = 1; i <= m; i++) { scanf("%d%d", &a, &b); con[a].push_back(b); ...
[["+", 0, 7, 8, 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], ["+", 8, 9, 0, 57, 75, 76, 0, 1, 0, 35]]
1
233
n,m = map(int,input().split()) h = list(map(int,input().split())) root = [[] for i in range(n)] for _ in range(n-1): a, b = (int(x) for x in input().split()) root[b-1].append(a-1) root[a-1].append(b-1) ans = 0 for i in range(n): flag = True if len(root[i]) > 0: for j in root[i]: ...
n,m = map(int,input().split()) h = list(map(int,input().split())) root = [[] for i in range(n)] for _ in range(m): a, b = (int(x) for x in input().split()) root[b-1].append(a-1) root[a-1].append(b-1) ans = 0 for i in range(n): flag = True if len(root[i]) > 0: for j in root[i]: ...
[["-", 0, 7, 12, 652, 3, 4, 0, 657, 31, 22], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 17, 33], ["-", 0, 7, 12, 652, 3, 4, 0, 657, 12, 612], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
160
n, m = gets.split.map(&:to_i) hs = gets.split.map(&:to_i) arr = Array.new(n, 1) m.times do a, b = gets.split.map(&:to_i).sort! arr[a - 1] = 0 if hs[a - 1] <= hs[b - 1] arr[b - 1] = 0 if hs[a - 1] == hs[b - 1] end puts arr.count(1)
n, m = gets.split.map(&:to_i) hs = gets.split.map(&:to_i) arr = Array.new(n, 1) m.times do a, b = gets.split.map(&:to_i) arr[a - 1] = 0 if hs[a - 1] <= hs[b - 1] arr[b - 1] = 0 if hs[b - 1] <= hs[a - 1] end puts arr.count(1)
[["-", 196, 737, 8, 736, 0, 662, 12, 652, 17, 131], ["-", 196, 737, 8, 736, 0, 662, 12, 652, 735, 22], ["-", 0, 751, 15, 738, 31, 742, 0, 738, 31, 22], ["+", 0, 751, 15, 738, 31, 742, 0, 738, 31, 22], ["-", 196, 737, 8, 736, 0, 751, 15, 738, 17, 60], ["+", 196, 737, 8, 736, 0, 751, 15, 738, 17, 19], ["-", 0, 751, 15, 7...
4
105
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define endl '\n' #define all(s) s.begin(), s.end() #define lowbit(x) (x & -x) #define rep(i, a, n) for (int i = a; i <= n; i++) #define IOS ...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <queue> #include <set> #include <string> #include <vector> #define endl '\n' #define all(s) s.begin(), s.end() #define lowbit(x) (x & -x) #define rep(i, a, n) for (int i = a; i <= n; i++) #define IOS ...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18]]
1
319
#include <algorithm> #include <iostream> using namespace std; #define SIZE 100000 int main() { long long int i, j, k, N, M, K, Q, d; // long long int A[100][100]; long long int H[SIZE], A[SIZE], B[SIZE]; long T[SIZE]; long long sol; cin >> N >> M; for (i = 0; i < N; i++) { cin >> H[i]; T[i] = ...
#include <algorithm> #include <iostream> using namespace std; #define SIZE 100000 int main() { long long int i, j, k, N, M, K, Q, d; // long long int A[100][100]; long long int H[SIZE], A[SIZE], B[SIZE]; long T[SIZE]; long long sol; cin >> N >> M; for (i = 0; i < N; i++) { cin >> H[i]; T[i] = ...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
238
import sys def input(): return sys.stdin.readline().rstrip() def main(): n,m=map(int,input().split()) H=[int(_) for _ in input().split()] HH= [0]*n for i in range(m): a,b=map(int,input().split()) HH[a-1]=max(HH[a-1],H[b-1]) HH[b-1]=max(HH[b-1],H[a-1]) ans=0 for i,hh in e...
import sys def input(): return sys.stdin.readline().rstrip() def main(): n,m=map(int,input().split()) H=[int(_) for _ in input().split()] HH= [0]*n for i in range(m): a,b=map(int,input().split()) HH[a-1]=max(HH[a-1],H[b-1]) HH[b-1]=max(HH[b-1],H[a-1]) ans=0 for i,hh in e...
[["-", 8, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["-", 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]]
5
181
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) N, M = map(int, readline().split()) H = list(map(int, readline().split())) G = [[] for _ in range(N)] for _ in range(M): A, B = map(int, readline().split()) G[A-1]...
import sys readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines read = sys.stdin.buffer.read sys.setrecursionlimit(10 ** 7) N, M = map(int, readline().split()) H = list(map(int, readline().split())) G = [[] for _ in range(N)] for _ in range(M): A, B = map(int, readline().split()) G[A-1]...
[["-", 0, 1, 0, 662, 12, 206, 206, 657, 17, 33], ["-", 0, 1, 0, 662, 12, 206, 206, 657, 12, 612]]
5
182
n, m = map(int,input().split()) graph = {i:[] for i in range(n)} H = list(map(int,input().split())) for _ in range(m): a,b = map(int,input().split()) a, b = a-1, b-1 if H[a]<H[b]: graph[a].append(b) elif H[b]>H[a]: graph[b].append(a) else: graph[a].append(b) graph[b].append(a) ans = 0 ...
n, m = map(int,input().split()) graph = {i:[] for i in range(n)} H = list(map(int,input().split())) for _ in range(m): a,b = map(int,input().split()) a, b = a-1, b-1 if H[a]<H[b]: graph[a].append(b) elif H[a]>H[b]: graph[b].append(a) else: graph[a].append(b) graph[b].append(a) ans = 0 for ...
[["-", 0, 57, 75, 665, 15, 666, 0, 206, 206, 22], ["+", 0, 57, 75, 665, 15, 666, 0, 206, 206, 22]]
5
172
#include <algorithm> #include <bits/stdc++.h> #define Freopen(x) \ freopen(#x ".in", "r", stdin), freopen(#x ".out", "w", stdout); #define int long long using namespace std; struct Edg { int fr, to, nxt; } edge[200010]; int head[100010], cnt = 0; int hight...
#include <algorithm> #include <bits/stdc++.h> #define Freopen(x) \ freopen(#x ".in", "r", stdin), freopen(#x ".out", "w", stdout); #define int long long using namespace std; struct Edg { int fr, to, nxt; } edge[200010]; int head[100010], cnt = 0; int hight...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
297
n, m = gets.chomp.split(" ").map(&:to_i) h = gets.chomp.split(" ").map(&:to_i) root = Array.new(n).map{Array.new} ans = 0 m.times do a, b = gets.chomp.split(" ").map(&:to_i) root[a-1] << b root[b-1] << a end root.each_with_index do |arr, idx| if arr.empty? then next end flag = true ...
n, m = gets.chomp.split(" ").map(&:to_i) h = gets.chomp.split(" ").map(&:to_i) root = Array.new(n).map{Array.new} ans = 0 m.times do a, b = gets.chomp.split(" ").map(&:to_i) root[a-1] << b root[b-1] << a end root.each_with_index do |arr, idx| if arr.empty? then ans += 1 next end ...
[["+", 8, 736, 0, 121, 64, 749, 0, 755, 31, 22], ["+", 8, 736, 0, 121, 64, 749, 0, 755, 17, 107], ["+", 8, 736, 0, 121, 64, 749, 0, 755, 12, 612], ["-", 196, 737, 8, 736, 0, 751, 15, 738, 17, 18], ["+", 196, 737, 8, 736, 0, 751, 15, 738, 17, 19]]
4
151
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [[int(i) for i in input().split()] for i in range(m)] l = [1] * n for i in range(m): if h[ab[i][0] - 1] < h[ab[i][1] - 1]: l[ab[i][0] - 1] = 0 elif h[ab[i][0] - 1] < h[ab[i][1] - 1]: l[ab[i][1] - 1] = 0 else: l...
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [[int(i) for i in input().split()] for i in range(m)] l = [1] * n for i in range(m): if h[ab[i][0] - 1] < h[ab[i][1] - 1]: l[ab[i][0] - 1] = 0 elif h[ab[i][0] - 1] > h[ab[i][1] - 1]: l[ab[i][1] - 1] = 0 else: l...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47]]
5
197
n,m = map(int, input().split()) h = list(map(int, input().split())) t = [1 for i in range(n)] for i in range(0,m): a,b = map(int, input().split()) if h[a-1] >= h[b-1]: t[b-1] = 0 elif h[a-1] <= h[b-1]: t[a-1] = 0 print(sum(t))
n,m = map(int, input().split()) h = list(map(int, input().split())) t = [1 for i in range(n)] for i in range(0,m): a,b = map(int, input().split()) if h[a-1] >= h[b-1]: t[b-1] = 0 if h[a-1] <= h[b-1]: t[a-1] = 0 print(sum(t))
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
124
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 # pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation """Module docstring """ import functools import heapq import itertools import logging import math import random import string import sys from argparse import ArgumentParser from co...
#!/usr/bin/env python3 # vim: set fileencoding=utf-8 # pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation """Module docstring """ import functools import heapq import itertools import logging import math import random import string import sys from argparse import ArgumentParser from co...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121]]
5
579
n, m = list(map(int, input().split(' '))) hn = list(map(int, input().split(' '))) abm = [None] * m d = defaultdict(list) for i in range(m): v = list(map(int, input().split(' '))) d[v[0]].append(v[1]) d[v[1]].append(v[0]) count = 0 for i in range(1, n + 1): cand = d.get(i) if cand is None: ...
from collections import defaultdict n, m = list(map(int, input().split(' '))) hn = list(map(int, input().split(' '))) abm = [None] * m d = defaultdict(list) for i in range(m): v = list(map(int, input().split(' '))) d[v[0]].append(v[1]) d[v[1]].append(v[0]) count = 0 for i in range(1, n + 1): ca...
[["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 314], ["+", 36, 36, 0, 656, 0, 686, 687, 673, 0, 22], ["+", 36, 36, 36, 36, 0, 656, 0, 686, 0, 487], ["+", 36, 36, 0, 656, 0, 686, 141, 673, 0, 22]]
5
182
from sys import stdin from collections import defaultdict N,M = [int(x) for x in stdin.readline().rstrip().split()] H = [int(x) for x in stdin.readline().rstrip().split()] d = defaultdict(set) for i in range(M): A,B = [int(x) for x in stdin.readline().rstrip().split()] d[A].add(B) d[B].add(A) ans = 0 f...
from sys import stdin from collections import defaultdict N,M = [int(x) for x in stdin.readline().rstrip().split()] H = [int(x) for x in stdin.readline().rstrip().split()] d = defaultdict(set) for i in range(M): A,B = [int(x) for x in stdin.readline().rstrip().split()] d[A].add(B) d[B].add(A) ans = 0 f...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 20]]
5
170
import numpy as np N, M = map(int,input().split()) H = list(map(int,input().split())) goodpoint = [1]*N #1 is good point for i in range (M): A, B = map(int,input().split()) if H[A-1] <=H[B-1]: goodpoint[A-1] = 0 if H[B-1] <=H[A-1]: goodpoint[B-1] = 0 print(sum((np.array(goodpoint)==0)*1))
import numpy as np N, M = map(int,input().split()) H = list(map(int,input().split())) goodpoint = [1]*N #1 is good point for i in range (M): A, B = map(int,input().split()) if H[A-1] <=H[B-1]: goodpoint[A-1] = 0 if H[B-1] <=H[A-1]: goodpoint[B-1] = 0 print(sum((np.array(goodpoint)==1)*1))#...
[["-", 3, 4, 0, 657, 31, 23, 0, 666, 0, 612], ["+", 3, 4, 0, 657, 31, 23, 0, 666, 0, 612]]
5
133
n,m=map(int, input().split()) h=list(map(int, input().split())) root=[list(map(int,input().split())) for _ in range(m)] ans=0 lis=[1 for _ in range(n)] for i in range(len(root)): a=root[i][0] b=root[i][1] if h[a-1] > h[b-1]: lis[b-1]=0 elif h[a-1]< h[b-1]: lis[a-1]=0 else: ...
n,m=map(int, input().split()) h=list(map(int, input().split())) root=[list(map(int,input().split())) for _ in range(m)] ans=0 lis=[1 for _ in range(n)] for i in range(len(root)): a=root[i][0] b=root[i][1] if h[a-1] > h[b-1]: lis[b-1]=0 elif h[a-1]< h[b-1]: lis[a-1]=0 else: ...
[["-", 8, 196, 0, 1, 0, 662, 31, 684, 0, 21], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 75, 76, 8, 196, 0, 1, 0, 662, 12, 612]]
5
176
n,m = map(int,input().split()) h_list = list(map(int,input().split())) n_list = [1]*n for i in range(m): a,b = map(int,input().split()) if h_list[a-1] > h_list[b-1]: n_list[b-1] = 0 elif h_list[a-1] < h_list[b-1]: n_list[b-1] = 0 else: n_list[b-1] = 0 n_list[b-1] = 0 coun...
n,m = map(int,input().split()) h_list = list(map(int,input().split())) n_list = [1]*n for i in range(m): a,b = map(int,input().split()) if h_list[a-1] > h_list[b-1]: n_list[b-1] = 0 elif h_list[a-1] < h_list[b-1]: n_list[a-1] = 0 else: n_list[a-1] = 0 n_list[b-1] = 0 coun...
[["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22]]
5
148
import sys input = sys.stdin.readline N,M = list(map(int,input().split())) H = list(map(int,input().split())) # 展望台から行ける展望台の高さを格納しておく from collections import defaultdict d = defaultdict(int) for i in range(M): A,B = list(map(int,input().split())) A -= 1 B -= 1 if d[A] < H[B]: d[A] = H[B] if d[B] < H[A]:...
import sys input = sys.stdin.readline N,M = list(map(int,input().split())) H = list(map(int,input().split())) # 展望台から行ける展望台の高さを格納しておく from collections import defaultdict d = defaultdict(int) for i in range(M): A,B = list(map(int,input().split())) A -= 1 B -= 1 if d[A] < H[B]: d[A] = H[B] if d[B] < H[A]:...
[["-", 8, 196, 0, 57, 15, 679, 12, 666, 667, 18], ["+", 8, 196, 0, 57, 15, 679, 12, 666, 667, 47]]
5
166
#include <cstdio> #include <cstring> inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); } return x * f; } int n, k, cnt; int h[1000...
#include <cstdio> #include <cstring> inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch > '9' || ch < '0') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - 48; ch = getchar(); } return x * f; } int n, k, cnt; int h[1000...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
272
N, M = map(int, input().split()) Hi = list(map(int, input().split())) is_judge_list = [1 for i in range(N)] for j in range(M): A, B = map(int, input().split()) if Hi[A-1] > Hi[B-1]: is_judge_list[B-1] = 0 elif Hi[B-1] > Hi[A-1]: is_judge_list[A-1] = 0 else: is_judge_list[A-1] = ...
N, M = map(int, input().split()) Hi = list(map(int, input().split())) is_judge_list = [1 for i in range(N)] for j in range(M): A, B = map(int, input().split()) if Hi[A-1] > Hi[B-1]: is_judge_list[B-1] = 0 elif Hi[B-1] > Hi[A-1]: is_judge_list[A-1] = 0 else: is_judge_list[A-1] = ...
[["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
142
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <time.h> using namespace std; typedef long long ll; const double pi = acos(-1.0); const ll mod = 1e9 + 7; const int inf = 0x3f3f3f3f; // ll begin_time=clock(); // ll end_time=clock();printf("time=%lldm...
#include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <map> #include <time.h> using namespace std; typedef long long ll; const double pi = acos(-1.0); const ll mod = 1e9 + 7; const int inf = 0x3f3f3f3f; // ll begin_time=clock(); // ll end_time=clock();printf("time=%lldm...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
227
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long // increase stack size #pragma comment(linker, "/STACK:16777216") ll mxm() { return LLONG_MIN; } template <typename... Args> ll mxm(ll a, Args... args) { return max(a, mxm(args...))...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long // increase stack size #pragma comment(linker, "/STACK:16777216") ll mxm() { return LLONG_MIN; } template <typename... Args> ll mxm(ll a, Args... args) { return max(a, mxm(args...))...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
754
#include <algorithm> #include <climits> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define FAST_IO \ ios_base::sync_with_stdio(false), cin....
#include <algorithm> #include <climits> #include <cmath> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <string> #include <utility> #include <vector> #define FAST_IO \ ios_base::sync_with_stdio(false), cin....
[["+", 0, 338, 8, 9, 0, 57, 64, 9, 0, 45], ["+", 0, 338, 8, 9, 0, 57, 64, 9, 0, 46]]
1
279
N, M = gets.chomp.split(" ").map(&:to_i) H = gets.chomp.split(" ").map(&:to_i) P = {} M.times do a, b = gets.chomp.split(" ").map(&:to_i) P[a] = [] if P[a] == nil P[a] << b P[b] = [] if P[b] == nil P[b] << a end cnt = 0 N.times do |i| path = P[i + 1] cnt += 1 if path != nil || path.all? {|n| n < H[i]} e...
N, M = gets.chomp.split(" ").map(&:to_i) H = gets.chomp.split(" ").map(&:to_i) P = {} M.times do a, b = gets.chomp.split(" ").map(&:to_i) P[a] = [] if P[a] == nil P[a] << b P[b] = [] if P[b] == nil P[b] << a end cnt = 0 N.times do |i| path = P[i + 1] cnt += 1 if path == nil || path.all? {|n| H[n-1] < H[...
[["-", 8, 736, 0, 751, 15, 738, 31, 738, 17, 79], ["+", 8, 736, 0, 751, 15, 738, 31, 738, 17, 60], ["+", 196, 196, 8, 734, 0, 738, 31, 742, 500, 743], ["+", 196, 196, 8, 734, 0, 738, 31, 742, 0, 70], ["+", 8, 734, 0, 738, 31, 742, 0, 738, 17, 33], ["+", 8, 734, 0, 738, 31, 742, 0, 738, 12, 612], ["+", 196, 196, 8, 734,...
4
150
# -*- coding: utf-8 -*- n, m = map(int, input().split()) h = list(map(int, input().split())) h_cond = [True]*n count = 0 for i in range(m): tmp_a, tmp_b = map(int, input().split()) if h[tmp_a-1] < h[tmp_b-1]: h_cond[tmp_a-1] = False elif h[tmp_a-1] > h[tmp_b-1]: h_cond[tmp_b-1] = False ...
# -*- coding: utf-8 -*- n, m = map(int, input().split()) h = list(map(int, input().split())) h_cond = [True]*n count = 0 for i in range(m): tmp_a, tmp_b = map(int, input().split()) if h[tmp_a-1] < h[tmp_b-1]: h_cond[tmp_a-1] = False elif h[tmp_a-1] > h[tmp_b-1]: h_cond[tmp_b-1] = False ...
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
157
n,m=map(int,input().split()) h=list(map(int,input().split())) ab=[list(map(int,input().split())) for i in range(m)] d=[ [] for i in range(n+1)] for i in range(m): #a=ab[i][0] #b=ab[i][1] d[ab[i][0]].append(h[ab[i][1]-1]) d[ab[i][1]].append(h[ab[i][0]-1]) count=0 d.pop(0) for i in range(0,len(d)): if len(d[i])...
n,m=map(int,input().split()) h=list(map(int,input().split())) ab=[list(map(int,input().split())) for i in range(m)] d=[ [] for i in range(n+1)] for i in range(m): #a=ab[i][0] #b=ab[i][1] d[ab[i][0]].append(h[ab[i][1]-1]) d[ab[i][1]].append(h[ab[i][0]-1]) count=0 d.pop(0) for i in range(0,len(d)): if len(d[i])...
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47]]
5
193
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF (int)1e9 + 7 #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i >= b; --i) #define vi vector<int> #define vl vector<ll> #define vii vector<vector<int>> #define vll vector<vector<long long>> #define pii...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define INF (int)1e9 + 7 #define rep(i, a, b) for (int i = a; i < b; ++i) #define rrep(i, a, b) for (int i = a; i >= b; --i) #define vi vector<int> #define vl vector<ll> #define vii vector<vector<int>> #define vll vector<vector<long long>> #define pii...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 7, 8, 9, 0, 43, 39, 40], ["+", 8, 9, 0, 7, 8, 9, 0, 43, 39, 78]]
1
363
def main(): N, M = map(int, input().split()) HN = list(map(int, input().split())) temp = [True for _ in range(N)] for _ in range(M): A, B = map(int, input().split()) if HN[A - 1] < HN[B - 1]: temp[A - 1] = False if HN[B - 1] < HN[A - 1]: temp[B - 1] = Fa...
def main(): N, M = map(int, input().split()) HN = list(map(int, input().split())) temp = [True for _ in range(N)] for _ in range(M): A, B = map(int, input().split()) if HN[A - 1] < HN[B - 1]: temp[A - 1] = False elif HN[B - 1] < HN[A - 1]: temp[B - 1] = ...
[["-", 8, 196, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683]]
5
156
from collections import defaultdict def main(): N, M = list(map(int, input().split(' '))) H = list(map(int, input().split(' '))) obs = defaultdict(list) for _ in range(M): A, B = list(map(int, input().split(' '))) A -= 1 B -= 1 obs[A].append(B) obs[B].append(A) ...
from collections import defaultdict def main(): N, M = list(map(int, input().split(' '))) H = list(map(int, input().split(' '))) obs = defaultdict(list) for _ in range(M): A, B = list(map(int, input().split(' '))) A -= 1 B -= 1 obs[A].append(B) obs[B].append(A) ...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94], ["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
186
N, M = map(int, input().split()) H = list(map(int, input().split())) S = [list(map(int, input().split())) for _ in range(M)] tmp=[0]*N for li in S: A=li[0]-1 B=li[1]-1 if H[A]>=H[B]: tmp[B]=1 elif H[A]<=H[B]: tmp[A]=1 c=tmp.count(0) print(c)
N, M = map(int, input().split()) H = list(map(int, input().split())) S = [list(map(int, input().split())) for _ in range(M)] tmp=[0]*N for li in S: A=li[0]-1 B=li[1]-1 if H[A]>=H[B]: tmp[B]=1 if H[A]<=H[B]: tmp[A]=1 c=tmp.count(0) print(c)
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
133
#include <cstdio> const int MAXN = 1e5; int h[MAXN + 5]; int n, m, bad[MAXN + 5]; signed main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%d", &h[i]); for (int i = 1, u, v; i <= m; ++i) { scanf("%d %d", &u, &v); if (h[v] <= h[u]) bad[v] = 1; else if (h[u] <= h[v]) ...
#include <cstdio> const int MAXN = 1e5; int h[MAXN + 5]; int n, m, bad[MAXN + 5]; signed main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; ++i) scanf("%d", &h[i]); for (int i = 1, u, v; i <= m; ++i) { scanf("%d %d", &u, &v); if (h[v] <= h[u]) bad[v] = 1; if (h[u] <= h[v]) ba...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
188
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int M = (int)1e5; const int N = (int)1e4; const int inf = 0x3f3f3f3f; const ll mod = (ll)1e9 + 7; int n, m, cnt; int head[M + 5]; struct node { int v, nx; } Edge[M * 2 + 5]; int h[M + 5]; int can[M + 5]; void init() { cnt = 0; for (int...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int M = (int)1e5; const int N = (int)1e4; const int inf = 0x3f3f3f3f; const ll mod = (ll)1e9 + 7; int n, m, cnt; int head[M + 5]; struct node { int v, nx; } Edge[M * 2 + 5]; int h[M + 5]; int can[M + 5]; void init() { cnt = 0; for (int...
[["-", 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
454
n,m = gets.chomp.split(' ').map(&:to_i) h = gets.chomp.split(' ').map(&:to_i) hash = {} array = Array.new(n,true) m.times do a,b = gets.chomp.split(' ').map(&:to_i) if (h[a-1] >= h[b-1]) array[b-1] = false elsif(h[a-1] <= h[b-1]) array[a-1] = false end end puts array.count(true)
n,m = gets.chomp.split(' ').map(&:to_i) h = gets.chomp.split(' ').map(&:to_i) array = Array.new(n,true) m.times do a,b = gets.chomp.split(' ').map(&:to_i) if (h[a-1] >= h[b-1]) array[b-1] = false end if(h[a-1] <= h[b-1]) array[a-1] = false end end puts array.count(true)
[["-", 36, 36, 36, 36, 0, 493, 0, 662, 31, 22], ["-", 36, 36, 36, 36, 0, 493, 0, 662, 0, 32], ["-", 36, 36, 0, 493, 0, 662, 12, 767, 0, 45], ["-", 36, 36, 0, 493, 0, 662, 12, 767, 0, 46], ["-", 196, 737, 8, 736, 0, 121, 75, 759, 0, 759], ["+", 0, 652, 196, 737, 8, 736, 0, 121, 0, 444], ["+", 0, 652, 196, 737, 8, 736, 0...
4
133
#include <iostream> using namespace std; int main(void) { int n, m; cin >> n >> m; int h[100000]; for (int i(0); i < n; i++) { cin >> h[i]; } int a[100000], b[100000]; for (int i(0); i < m; i++) { cin >> a[i] >> b[i]; } bool bad_view[100000] = {0}; for (int i(0); i < m; i++) { if (h[a[i]...
#include <iostream> using namespace std; int main(void) { int n, m; cin >> n >> m; int h[100000]; for (int i(0); i < n; i++) { cin >> h[i]; } int a[100000], b[100000]; for (int i(0); i < m; i++) { cin >> a[i] >> b[i]; } bool bad_view[100000] = {0}; for (int i(0); i < m; i++) { if (h[a[i]...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
234
n,m=map(int,input().split()) h=list(map(int,input().split())) gooddict={i:1 for i in range(1,n+1)} for i in range(m): a,b=map(int,input().split()) if h[a-1]<=h[b-1]: gooddict[a]=0 if h[a-1]>=h[b-1]: gooddict[b]=0 count=0 for i in range(1,n+1): if gooddict[i]==1: count+=1 print(count) print(good...
n,m=map(int,input().split()) h=list(map(int,input().split())) gooddict={i:1 for i in range(1,n+1)} for i in range(m): a,b=map(int,input().split()) if h[a-1]<=h[b-1]: gooddict[a]=0 if h[a-1]>=h[b-1]: gooddict[b]=0 count=0 for i in range(1,n+1): if gooddict[i]==1: count+=1 print(count)
[["-", 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
151
N,M=map(int,input().split()) H=list(map(int,input().split())) graph=[0]*N for i in range(M): A,B=map(int,input().split()) A,B=A-1,B-1 if H[A]<H[B]: graph[A]+=1 elif H[B]>H[A]: graph[B]+=1 else: graph[A]+=1 graph[B]+=1 ans=graph.count(0) print(ans)
N,M=map(int,input().split()) H=list(map(int,input().split())) graph=[0]*N for i in range(M): A,B=map(int,input().split()) A,B=A-1,B-1 if H[A]<H[B]: graph[A]+=1 elif H[B]<H[A]: graph[B]+=1 else: graph[A]+=1 graph[B]+=1 ans=graph.count(0) print(ans)
[["-", 8, 196, 0, 57, 75, 665, 15, 666, 667, 47], ["+", 8, 196, 0, 57, 75, 665, 15, 666, 667, 18]]
5
135
N, M = map(int, input().split()) H = list(map(int, input().split())) flag = [False for i in range(N)] count = N for i in range(M): a, b = map(int, input().split()) if H[a - 1] <= H[b - 1] and flag[a - 1] is False: flag[a - 1] = True count -= 1 elif H[a - 1] >= H[b - 1] and flag[b - 1] is Fa...
N, M = map(int, input().split()) H = list(map(int, input().split())) flag = [False for i in range(N)] count = N for i in range(M): a, b = map(int, input().split()) if H[a - 1] <= H[b - 1] and flag[a - 1] is False: flag[a - 1] = True count -= 1 if H[a - 1] >= H[b - 1] and flag[b - 1] is Fals...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
146
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) int main() { /* string s; cin>>s; if(s=="ABC") { cout<<"ARC"<<endl; } else { cout<<"ABC"<<endl; } */ /* int n,k; cin>>n>>k; map <int,int> mp; for(int i=1;i<=k;...
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, n) for (int i = 0; i < n; i++) int main() { /* string s; cin>>s; if(s=="ABC") { cout<<"ARC"<<endl; } else { cout<<"ABC"<<endl; } */ /* int n,k; cin>>n>>k; map <int,int> mp; for(int i=1;i<=k;...
[["-", 0, 77, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 77, 39, 344, 3, 347, 0, 77, 39, 78], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
221
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n); vector<bool> hans(n, true); for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; if (h[a] < h[b]) hans[a] = false; el...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n); vector<bool> hans(n, true); for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; if (h[a] < h[b]) hans[a] = false; el...
[["-", 75, 76, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 12, 147], ["+", 0, 57, 75, 76, 0, 9, 0, 1, 0, 35], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
1
174
n,m = gets.chomp.split(" ").map{|e|e.to_i} h = gets.chomp.split(" ").map{|e|e.to_i} good = Array.new(n, true) m.times do a, b = gets.chomp.split(" ").map{|e|e.to_i} a -= 1 b -= 1 if h[a]>h[b] then good[b] = false elsif h[a]<h[b] then good[a] = false else good[a] = false good[b] = false end end p h sum ...
n,m = gets.chomp.split(" ").map{|e|e.to_i} h = gets.chomp.split(" ").map{|e|e.to_i} good = Array.new(n, true) m.times do a, b = gets.chomp.split(" ").map{|e|e.to_i} a -= 1 b -= 1 if h[a]>h[b] then good[b] = false elsif h[a]<h[b] then good[a] = false else good[a] = false good[b] = false end end sum = 0 ...
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
159
import sys import math def I():return int(sys.stdin.readline().replace("\n","")) def I2():return map(int,sys.stdin.readline().replace("\n","").split()) def S():return str(sys.stdin.readline().replace("\n","")) def L():return list(sys.stdin.readline().replace("\n","")) def Intl():return [int(k) for k in sys.stdin.readli...
import sys import math def I():return int(sys.stdin.readline().replace("\n","")) def I2():return map(int,sys.stdin.readline().replace("\n","").split()) def S():return str(sys.stdin.readline().replace("\n","")) def L():return list(sys.stdin.readline().replace("\n","")) def Intl():return [int(k) for k in sys.stdin.readli...
[["+", 8, 196, 0, 57, 64, 196, 0, 116, 0, 117]]
5
329
#include <stdio.h> int main(void) { int n, m, h[100001], a[100001], b[100001], i, j, c[100001], d[100001], e; e = 0; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) { scanf("%d", &h[i]); } for (i = 0; i < m; i++) { scanf("%d %d", &a[i], &b[i]); /*printf("%d %d\n",a[i],b[i]);*/ } for (i = 1; ...
#include <stdio.h> int main(void) { int n, m, h[100001], a[100001], b[100001], i, j, c[100001], d[100001], e; e = 0; scanf("%d %d", &n, &m); for (i = 0; i < n; i++) { scanf("%d", &h[i]); } for (i = 0; i < m; i++) { scanf("%d %d", &a[i], &b[i]); /*printf("%d %d\n",a[i],b[i]);*/ } for (i = 1; ...
[["-", 8, 9, 0, 57, 15, 23, 0, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 20], ["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 17, 19]]
0
302
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define per(i, a, b) for (int i = (b)-1; i >= (a); --i) #define sz(x) (int)x.size() #define de(a) cout << #a << " = " << a << endl #define dd(a)...
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for (int i = (a); i < (b); ++i) #define per(i, a, b) for (int i = (b)-1; i >= (a); --i) #define sz(x) (int)x.size() #define de(a) cout << #a << " = " << a << endl #define dd(a)...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13], ["+", 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
342
n,m = map(int,input().split()) h = list(map(int,input().split())) ans = [1]*n for i in range(m): a,b = map(int,input().split()) if h[a-1]>h[b-1]: ans[b-1] = 0 if h[b-1]>h[a-1]: ans[a-1] = 0 else: ans[a-1] = 0 ans[b-1] = 0 print(ans.count(1))
n,m = map(int,input().split()) h = list(map(int,input().split())) ans = [1]*n for i in range(m): a,b = map(int,input().split()) if h[a-1]>h[b-1]: ans[b-1] = 0 elif h[b-1]>h[a-1]: ans[a-1] = 0 else: #print("a") ans[a-1] = 0 ans[b-1] = 0 print(ans.count(1)) ...
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683]]
5
137
N, M = map(int,input().split()) good = [0]*N H = list(map(int,input().split())) for j in range(M): a, b = map(int,input().split()) if(H[a-1] == H[b-1]): good[a-1] += 1 good[b-1] += 1 break elif(H[a-1] < H[b-1]): good[a-1] += 1 else: good[b-1] += 1 count = 0 for i in range(N): if(good[i] ...
N, M = map(int,input().split()) good = [0]*N H = list(map(int,input().split())) for j in range(M): a, b = map(int,input().split()) if(H[a-1] == H[b-1]): good[a-1] += 1 good[b-1] += 1 elif(H[a-1] < H[b-1]): good[a-1] += 1 else: good[b-1] += 1 count = 0 for i in range(N): if(good[i] == 0): ...
[["-", 8, 196, 0, 57, 64, 196, 0, 93, 0, 94]]
5
161
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; const int mod = 1e9 + 7; ll qpow(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } bool ok[maxn]; int a[maxn]; int main() { memset(ok, 1, si...
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 1e5 + 5; const int mod = 1e9 + 7; ll qpow(ll a, ll b) { ll res = 1; for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } bool ok[maxn]; int a[maxn]; int main() { memset(ok, 1, si...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
262
#include <bits/stdc++.h> #define ll long long using namespace std; int m, n, t = 1, yy[100005], vis[100005], d, sum, hh[100005]; struct SY { int t, back; } sy[200005]; int main() { scanf("%d%d", &m, &n); int a, b; for (int i = 1; i <= m; ++i) scanf("%d", &vis[i]); for (int i = 0; i < n; ++i) { scanf("...
#include <bits/stdc++.h> #define ll long long using namespace std; int m, n, t = 1, yy[100005], vis[100005], d, sum, hh[100005]; struct SY { int t, back; } sy[200005]; int main() { scanf("%d%d", &m, &n); int a, b; for (int i = 1; i <= m; ++i) scanf("%d", &vis[i]); for (int i = 0; i < n; ++i) { scanf("...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
288
N, M = map(int, input().split()) heights = list(map(int, input().split())) highest = [True for _ in range(N)] for m in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 val_a = heights[a] val_b = heights[b] # print("a= {} b= {}".format(a,b)) # print("vala= {} valb= {}".format(val_a,va...
N, M = map(int, input().split()) heights = list(map(int, input().split())) highest = [True for _ in range(N)] for m in range(M): a, b = map(int, input().split()) a -= 1 b -= 1 val_a = heights[a] val_b = heights[b] # print("a= {} b= {}".format(a,b)) # print("vala= {} valb= {}".format(val_a,va...
[["-", 8, 196, 0, 1, 0, 662, 31, 206, 51, 22], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 0, 70], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 206, 612], ["-", 8, 196, 0, 1, 0, 662, 31, 206, 0, 73], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 1, 0, 662, 12, 147]]
5
141
N,M=map(int,input().split()) H=list(map(int,input().split())) good=[True]*N for i in range(M): A,B=map(int,input().split()) if H[A-1]>H[B-1]: print("A") good[B-1]=False elif H[B-1]>H[A-1]: good[A-1]=False else: good[A-1],good[B-1]=False,False ans=0 for i in good: if i...
N,M=map(int,input().split()) H=list(map(int,input().split())) good=[True]*N for i in range(M): A,B=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],good[B-1]=False,False ans=0 for i in good: if i==True: ans...
[["-", 0, 57, 64, 196, 0, 1, 0, 652, 63, 22], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 24], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 654], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 6], ["-", 0, 1, 0, 652, 3, 4, 0, 557, 0, 655], ["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 25], ["-", 0, 656, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 1,...
5
155
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define FORR(i, m, n) for (int i = (m); i >= (n); i--) #define...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vector<int>>; using vl = vector<ll>; using vvl = vector<vector<ll>>; #define FOR(i, m, n) for (int i = (m); i < (n); i++) #define FORR(i, m, n) for (int i = (m); i >= (n); i--) #define...
[["+", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
597