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 <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, k; int d[105]; int a[105][105]; int sunuke[105]; int sum = 0; scanf("%d %d", &n, &k); for (int i = 0; i < k; i++) { scanf("%d", &d[i]); for (int j = 0; j < d[i]; j++) { scanf("%d", &a[i][j])...
#include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { int n, k; int d[105]; int a[105][105]; int sunuke[105]; int sum = 0; scanf("%d %d", &n, &k); for (int i = 0; i < k; i++) { scanf("%d", &d[i]); for (int j = 0; j < d[i]; j++) { scanf("%d", &a[i][j])...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
0
233
#include <bits/stdc++.h> #define mod 1000000007 #define ll long long int #define ar array #define pb push_back using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; int a[n + 1]; for (int i = 0; i < k; i++) { int j; cin >> j; for (int h = 0; h < ...
#include <bits/stdc++.h> #define mod 1000000007 #define ll long long int #define ar array #define pb push_back using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; int a[n + 1] = {0}; for (int i = 0; i < k; i++) { int j; cin >> j; for (int h = 0...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 13], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46]]
1
148
#include <bits/stdc++.h> #define int long long int #define ld long double #define getFaster \ ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define rep(i, init, n) for (int i = init; i < n; i++) #define rev(i, n, init) for (int i = n; i >=...
#include <bits/stdc++.h> #define int long long int #define ld long double #define getFaster \ ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define rep(i, init, n) for (int i = init; i < n; i++) #define rev(i, n, init) for (int i = n; i >=...
[["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 70], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 22], ["+", 12, 23, 0, 16, 31, 69, 341, 342, 0, 73]]
1
228
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; bool sunuke[N + 1] = {false}; for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int n; cin >> n; sunuke[n] = true; } } int ans = 0; for (int i = 1; i < N;...
#include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; bool sunuke[N + 1] = {false}; for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int n; cin >> n; sunuke[n] = true; } } int ans = 0; for (int i = 1; i < N ...
[["+", 8, 9, 0, 7, 15, 16, 12, 16, 17, 72], ["+", 8, 9, 0, 7, 15, 16, 12, 16, 12, 13]]
1
132
def main(): n, k = map(int, input().split()) d = [None for _ in range(k)] a = [None for _ in range(k)] for i in range(k): d[i] = int(input()) a[i] = list(map(int, input().split())) tricked = [True for _ in range(n)] for i in range(k): for j in range(d[i]): tr...
def main(): n, k = map(int, input().split()) d = [None for _ in range(k)] a = [None for _ in range(k)] for i in range(k): d[i] = int(input()) a[i] = list(map(int, input().split())) tricked = [True for _ in range(n)] for i in range(k): for j in range(d[i]): tr...
[["-", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 8, 196, 0, 7, 12, 652, 3, 4, 0, 22]]
5
163
// READ & UNDERSTAND // ll, int overflow, array bounds, memset(0) // special cases (n=1?), n+1 (1-index) // do smth instead of nothing & stay organized // WRITE STUFF DOWN #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #defi...
// READ & UNDERSTAND // ll, int overflow, array bounds, memset(0) // special cases (n=1?), n+1 (1-index) // do smth instead of nothing & stay organized // WRITE STUFF DOWN #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define all(x) (x).begin(), (x).end() #defi...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
210
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N, K; cin >> N >> K; bool ans[N]; int res = 0; for (int i = 0; i < N; i++) { ans[i] = false; } for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int t; cin >> t; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { int N, K; cin >> N >> K; bool ans[N]; int res = 0; for (int i = 0; i < N; i++) { ans[i] = false; } for (int i = 0; i < K; i++) { int d; cin >> d; for (int j = 0; j < d; j++) { int t; cin >> t; ...
[["+", 0, 11, 31, 69, 341, 342, 0, 16, 17, 33], ["+", 0, 11, 31, 69, 341, 342, 0, 16, 12, 13]]
1
156
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def I(): return int(sys.stdin.buffer.readline()) def LS():return...
#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.buffer.readline()) def LS():return [list(...
[["-", 63, 319, 500, 652, 63, 319, 500, 319, 319, 22], ["-", 12, 652, 63, 319, 500, 652, 63, 319, 0, 131], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32]]
5
288
#ABC166 N,M=map(int,input().split()) H =list(map(int,input().split())) #展望台の標高 A = list(range(N)) for i in range(M): a, b = map(int, input().split()) if H[a-1]>H[b-1]: A[b-1] = 0 elif H[a-1]<H[b-1]: A[a-1] = 0 else: A[a-1] = 0 A[b-1] = 0 print(N-A.count(0))
#ABC166 N,M=map(int,input().split()) H =list(map(int,input().split())) #展望台の標高 A = list(range(1,N+1)) for i in range(M): a, b = map(int, input().split()) if H[a-1] > H[b-1]: A[b-1] = 0 elif H[a-1] < H[b-1]: A[a-1] = 0 else: A[a-1] = 0 A[b-1] = 0 print(N-A.count(0))
[["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 12, 652, 3, 4, 0, 652, 3, 4, 0, 21], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 17, 72], ["+", 3, 4, 0, 652, 3, 4, 0, 657, 12, 612]]
5
143
n,m=map(int, input().split()) h=list(map(int, input().split())) near=[[i] for i in h] for i in range(m): a,b=map(int, input().split()) near[a-1].append(h[b-1]) near[b-1].append(h[a-1]) cnt=0 for i in range(n): if max(near[i])<=h[i]: cnt+=1 print(cnt)
n,m=map(int, input().split()) h=list(map(int, input().split())) near=[[0] for i in h] for i in range(m): a,b=map(int, input().split()) near[a-1].append(h[b-1]) near[b-1].append(h[a-1]) cnt=0 for i in range(n): if max(near[i])<h[i]: cnt+=1 print(cnt)
[["-", 0, 1, 0, 662, 12, 658, 8, 634, 0, 22], ["+", 0, 1, 0, 662, 12, 658, 8, 634, 0, 612], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
132
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int mod = 1000000007; #define ll long long int main() { int n, k, d, a, ans = 0; cin >> n >> k; int sun[n] = {0}; rep(i, k) { cin >> d; rep(j, d) { cin >> a; sun[a - 1]++; } } rep(i, k) { ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) int mod = 1000000007; #define ll long long int main() { int n, k, d, a, ans = 0; cin >> n >> k; int sun[n] = {0}; rep(i, k) { cin >> d; rep(j, d) { cin >> a; sun[a - 1]++; } } rep(i, n) { ...
[["-", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 14, 49, 53, 54, 55, 0, 56, 39, 78]]
1
115
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, a, n) for (int i = n; i >= a; i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) #define mem(a, b) memset(a,...
#include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i <= n; i++) #define per(i, a, n) for (int i = n; i >= a; i--) #define pb push_back #define mp make_pair #define all(x) (x).begin(), (x).end() #define fi first #define se second #define SZ(x) ((int)(x).size()) #define mem(a, b) memset(a,...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 22]]
1
332
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
#include <bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair #define ios \ ios_base::sync_with_stdio(false); \ cin.tie(NULL); ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22]]
1
161
// PLUS ULTRA // one who sits atop all the clans : Lion's Sin Escanor #include <bits/stdc++.h> using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); ...
// PLUS ULTRA // one who sits atop all the clans : Lion's Sin Escanor #include <bits/stdc++.h> using namespace std; #define SPEED \ ios::sync_with_stdio(false); \ cin.tie(0); ...
[["-", 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, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
191
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(n + 1, 0); int d, a; for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> a; v[a]++; } } int cnt = 0; for...
#include <algorithm> #include <cmath> #include <iostream> #include <vector> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> v(n + 1, 0); int d, a; for (int i = 0; i < k; i++) { cin >> d; for (int j = 0; j < d; j++) { cin >> a; v[a]++; } } int cnt = 0; for...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 17, 18], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 17, 19]]
1
137
n, m = map(int,input().split()) h = list(map(int,input().split())) ab = [list(map(int,input().split())) for _ in range(m)] point = [0]*n app = [0]*n cnt = [] for i in ab: app[i[0]-1] += 1 app[i[1]-1] += 1 if h[i[0]-1] > h[i[1]-1]: point[i[0]-1] += 1 elif h[i[0]-1] < h[i[1]-1]: point[...
n, m = map(int,input().split()) h = list(map(int,input().split())) ab = [list(map(int,input().split())) for _ in range(m)] point = [0]*n app = [0]*n cnt = [] for i in ab: app[i[0]-1] += 1 app[i[1]-1] += 1 if h[i[0]-1] > h[i[1]-1]: point[i[0]-1] += 1 elif h[i[0]-1] < h[i[1]-1]: point[...
[["+", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 24], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 25]]
5
199
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: C_fix_2 # CreatedDate: 2020-08-08 01:59:29 +0900 # LastModified: 2020-08-08 02:09:05 +0900 # import os import sys # import numpy as np # import pandas as pd def main(): n, m = map(int, input().split()) h = [0] + list(map(int, input().split())) ...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: C_fix_2 # CreatedDate: 2020-08-08 01:59:29 +0900 # LastModified: 2020-08-08 02:11:36 +0900 # import os import sys # import numpy as np # import pandas as pd def main(): n, m = map(int, input().split()) h = [0] + list(map(int, input().split())) ...
[["-", 0, 57, 75, 665, 64, 196, 0, 674, 0, 675], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 31, 22], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 17, 107], ["+", 75, 665, 64, 196, 0, 1, 0, 677, 12, 612]]
5
177
n,m=map(int,input().split()) height=list(map(int,input().split())) hoge=[1 for i in range(n)] for i in range(m): a,b=map(int,input().split()) if(height[a-1]>height[b-1]): hoge[a-1]=0 elif(height[a-1]<height[b-1]): hoge[b-1]=0 else: hoge[a-1],hoge[a-1]=0,0 print(sum(hoge))
n,m=map(int,input().split()) height=list(map(int,input().split())) hoge=[1 for i in range(n)] #print(hoge) for i in range(m): a,b=map(int,input().split()) #print(a,b,height[a-1],height[b-1]) if(height[a-1]>height[b-1]): hoge[b-1]=0 elif(height[a-1]<height[b-1]): hoge[a-1]=0 else: hoge[a-1],hoge[b...
[["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["-", 0, 662, 31, 684, 0, 206, 206, 657, 31, 22], ["+", 0, 662, 31, 684, 0, 206, 206, 657, 31, 22]]
5
145
N, M = map(int, input().split()) H = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(M)] graph = [[] for _ in range(N)] for a, b in X: graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) ans = [True] * N for u in range(N): for v in graph[u]: ans[u] &= H[u] > H...
N, M = map(int, input().split()) H = list(map(int, input().split())) X = [list(map(int, input().split())) for _ in range(M)] graph = [[] for _ in range(N)] for a, b in X: graph[a - 1].append(b - 1) graph[b - 1].append(a - 1) ans = [True] * N for u in range(N): for v in graph[u]: ans[u] &= H[u] > H...
[["-", 3, 4, 0, 652, 3, 4, 0, 206, 0, 70], ["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 612], ["-", 0, 652, 3, 4, 0, 206, 206, 663, 0, 102], ["-", 3, 4, 0, 652, 3, 4, 0, 206, 0, 73]]
5
153
#include <stdio.h> int main() { int a, b, c = 0, i; int x[100000], y[100000], z[100000], w[100000] = {0}; scanf("%d %d", &a, &b); for (i = 1; i <= a; i++) { scanf("%d", &x[i]); } for (i = 1; i <= b; i++) { scanf("%d %d", &y[i], &z[i]); if (x[y[i]] == x[z[i]]) { w[y[i]]++; w[x[i]]++; ...
#include <stdio.h> int main() { int a, b, c = 0, i; int x[100001], y[100001], z[100001], w[100001] = {0}; scanf("%d %d", &a, &b); for (i = 1; i <= a; i++) { scanf("%d", &x[i]); } for (i = 1; i <= b; i++) { scanf("%d %d", &y[i], &z[i]); if (x[y[i]] == x[z[i]]) { w[y[i]]++; w[z[i]]++; ...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["+", 8, 9, 0, 43, 49, 50, 49, 80, 81, 13], ["-", 0, 1, 0, 27, 28, 69, 71, 69, 28, 22], ["+", 0, 1, 0, 27, 28, 69, 71, 69, 28, 22]]
0
239
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { int n, m, h[100000], a[100000], b[100000]; bool good[100000]; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> h[i]; good[i] = true; } for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; } int answer = 0; f...
#include <bits/stdc++.h> #include <math.h> using namespace std; int main() { int n, m, h[100000], a[100000], b[100000]; bool good[100000]; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> h[i]; good[i] = true; } for (int i = 0; i < m; i++) { cin >> a[i] >> b[i]; } int answer = 0; f...
[["-", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 161]]
1
215
n,m = map(int,input().split()) H = list(map(int,input().split())) a = [list(map(int,input().split())) for _ in range(m)] flag = [0]*n for i in range(m): if H[a[i][0]-1] > H[a[i][1]-1]: flag[a[i][0]-1] = 2 #flag[a[i][1]-1] = elif H[a[i][0]-1] == H[a[i][1]-1]: flag[a[i][0]-1] = 2 flag[a[i][1]-1] = 2 ...
n,m = map(int,input().split()) H = list(map(int,input().split())) a = [list(map(int,input().split())) for _ in range(m)] flag = [0]*n for i in range(m): if H[a[i][0]-1] > H[a[i][1]-1]: flag[a[i][1]-1] = 2 elif H[a[i][0]-1] == H[a[i][1]-1]: flag[a[i][0]-1] = 2 flag[a[i][1]-1] = 2 else: flag[a[i][0]...
[["-", 0, 662, 31, 206, 206, 657, 31, 206, 206, 612], ["+", 0, 662, 31, 206, 206, 657, 31, 206, 206, 612]]
5
214
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const int MOD = 1e9 + 7; int main() { int n, m; cin >> n >> m; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } map<int, vector<int>> path; for (int i = 0; i < m; i++) { int a, ...
#include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; const int MOD = 1e9 + 7; int main() { int n, m; cin >> n >> m; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } map<int, vector<int>> path; for (int i = 0; i < m; i++) { int a, ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20]]
1
227
N,M=map(int,input().split()) high=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)
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)
[["-", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22], ["+", 36, 36, 0, 656, 0, 1, 0, 662, 31, 22]]
5
137
n, m = map(int, input().split()) h = list(map(int, input().split())) ans = [1 for i in range(n)] for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 if h[a] >= h[b]: ans[b] = 0 elif h[b] >= h[a]: ans[a] = 0 print (sum(ans))
n, m = map(int, input().split()) h = list(map(int, input().split())) ans = [1 for i in range(n)] for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 if h[a] >= h[b]: ans[b] = 0 if h[b] >= h[a]: ans[a] = 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
116
import sys import time import math import itertools as it def inpl(): return list(map(int, input().split())) st = time.perf_counter() # ------------------------------ N, M = inpl() H = inpl() dp = [True] * M for _ in range(M): A, B = inpl() if H[A-1] > H[B-1]: dp[B-1] = False elif H[A-1] < H[B-...
import sys import time import math import itertools as it def inpl(): return list(map(int, input().split())) st = time.perf_counter() # ------------------------------ N, M = inpl() H = inpl() dp = [True] * N for _ in range(M): A, B = inpl() if H[A-1] > H[B-1]: dp[B-1] = False elif H[A-1] < H[B-...
[["-", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["+", 0, 656, 0, 1, 0, 662, 12, 657, 12, 22], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 60], ["-", 0, 7, 8, 196, 0, 57, 15, 666, 0, 146]]
5
181
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); ...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define endl "\n" typedef long long ll; const double pi = 3.14159265358979323846; int ctoi(const char c) { if ('0' <= c && c <= '9') return (c - '0'); return -1; } vector<int> input(int n) { vector<int> vec(n); ...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 13]]
1
1,099
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace...
#include <algorithm> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iomanip> #include <iostream> #include <limits> #include <list> #include <map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <vector> using namespace...
[["+", 0, 43, 49, 50, 51, 4, 0, 16, 17, 72], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 12, 13]]
1
1,162
#include <bits/stdc++.h> #define INF 2147483640 using namespace std; int h[100005], n, m, ans; vector<int> G[200005]; int main() { // freopen("out.txt","w",stdout); cin >> n >> m; for (int i = 0; i < n; i++) cin >> h[i]; for (int i = 0, a, b; i < m; i++) { cin >> a >> b; G[a].push_back(b); G[b]....
#include <bits/stdc++.h> #define INF 2147483640 using namespace std; int h[100005], n, m, ans; vector<int> G[200005]; int main() { // freopen("out.txt","w",stdout); cin >> n >> m; for (int i = 1; i <= n; i++) cin >> h[i]; for (int i = 0, a, b; i < m; i++) { cin >> a >> b; G[a].push_back(b); G[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], ["-", 0, 338, 8, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 338, 8, 57, 15, 339, 51, 16, 17, 19]]
1
175
N, M = map(int, input().split()) H = list(map(int, input().split())) AB = [list(map(int, input().split())) for i in range(M)] tf_array = [0]*N for a, b in AB: print(a,b) if H[a-1] > H[b-1]: tf_array[b-1] += 1 elif H[a-1] == H[b-1]: tf_array[a-1] += 1 tf_array[b-1] += 1 else: ...
N, M = map(int, input().split()) H = list(map(int, input().split())) AB = [list(map(int, input().split())) for i in range(M)] tf_array = [0]*N for a, b in AB: if H[a-1] > H[b-1]: tf_array[b-1] += 1 elif H[a-1] == H[b-1]: tf_array[a-1] += 1 tf_array[b-1] += 1 else: tf_array[...
[["-", 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
152
N, M = map(int, input().split()) #数字 H = list(map(int, input().split()))#リスト A = [list(map(int, input().split())) for i in range(M)] #数字、複数行複数列 good = [True]*N for i, j in A: print(i,j) i -= 1 j -= 1 if H[i] < H[j]: good[i] = False if H[i] > H[j]: good[j] = False if H[i] == H[...
N, M = map(int, input().split()) #数字 H = list(map(int, input().split()))#リスト A = [list(map(int, input().split())) for i in range(M)] #数字、複数行複数列 good = [True]*N for i, j in A: i -= 1 j -= 1 if H[i] < H[j]: good[i] = False if H[i] > H[j]: good[j] = False if H[i] == H[j]: goo...
[["-", 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
154
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int[] h = new int[n]; int[] ma = new int[n]; int count = 0; for (int i = 1; i <= n; i++) { h[i] = scan.nextI...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int[] h = new int[n + 1]; int[] ma = new int[n + 1]; int count = 0; for (int i = 1; i <= n; i++) { h[i] = sc...
[["+", 49, 200, 51, 227, 497, 505, 0, 16, 17, 72], ["+", 49, 200, 51, 227, 497, 505, 0, 16, 12, 499]]
3
230
def solve(): n, m = map(int, input().split()) h = list(map(int, input().split())) tenbo = [] bit = [0]*n for i in range(m): tenbo.append(list(map(int, input().split()))) hoge = [[] for i in range(n)] for i in range(m): hoge[tenbo[i][0]-1].append(tenbo[i][1]-1) hoge[tenbo[i][1]-1].append(tenbo[...
def solve(): n, m = map(int, input().split()) h = list(map(int, input().split())) tenbo = [] ans = 0 bit = [0]*n for i in range(m): tenbo.append(list(map(int, input().split()))) hoge = [[] for i in range(n)] for i in range(m): hoge[tenbo[i][0]-1].append(tenbo[i][1]-1) hoge[tenbo[i][1]-1].app...
[["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 0, 32], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 12, 612], ["-", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612], ["+", 0, 652, 3, 4, 0, 652, 3, 4, 0, 612]]
5
203
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = 100010; int n = sc.nextInt(); int m = sc.nextInt(); int[] h = new int[N]; int[] ma = new int[N]; for (int i = 1; i < n; i++) { h[i] = sc.nextInt(); ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = 100010; int n = sc.nextInt(); int m = sc.nextInt(); int[] h = new int[N]; int[] ma = new int[N]; for (int i = 1; i <= n; i++) { h[i] = sc.nextInt(); ...
[["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
235
n,m = map(int,input().split()) h = list(map(int,input().split())) ma = [0]*(n) for i in range(n): a,b = map(lambda x: int(x)-1,input().split()) ma[a] = max(ma[a], h[b]) ma[b] = max(h[a], ma[b]) ans = 0 for i in range(n): if h[i]>ma[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(lambda x: int(x)-1,input().split()) ma[a] = max(ma[a], h[b]) ma[b] = max(h[a], ma[b]) ans = 0 for i in range(n): if h[i]>ma[i]: ans+=1 print(ans)
[["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22]]
5
137
/* My heart’s beating faster I know what I’m after I’ve been standing here my whole life Everything I’ve seen twice Now it’s time I realized It’s spinning back around now On this road I’m crawlin’ Save me 'cause I’m fallin’ Now I can’t seem to breathe right 'Cause I keep runnin' runnin' runnin' runnin' Runnin' runnin'...
/* My heart’s beating faster I know what I’m after I’ve been standing here my whole life Everything I’ve seen twice Now it’s time I realized It’s spinning back around now On this road I’m crawlin’ Save me 'cause I’m fallin’ Now I can’t seem to breathe right 'Cause I keep runnin' runnin' runnin' runnin' Runnin' runnin'...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 22], ["-", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 22], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["-", 15, 339, 51, 16, 12, 69, 341, 342, 0, 2...
1
249
n, m = map(int, input().split()) h = list(map(int, input().split())) p = [False] + [True]*n A = [] B = [] for i in range(m): a, b = map(int,input().split()) A.append(a) B.append(b) for i in range(m): if h[A[i] - 1] > h[B[i] - 1]: p[B[i]] = False if h[A[i] - 1] < h[B[i] - 1]: p[A[i]]...
n, m = map(int, input().split()) h = list(map(int, input().split())) p = [False] + [True]*n A = [] B = [] for i in range(m): a, b = map(int,input().split()) A.append(a) B.append(b) for i in range(m): if h[A[i] - 1] > h[B[i] - 1]: p[B[i]] = False elif h[A[i] - 1] < h[B[i] - 1]: p[A[i...
[["-", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["+", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683]]
5
202
/*#include <bits/stdc++.h> using namespace std; int main(){ int obs,rd; cin >> obs >> rd; // vector<long long> hgt(obs); map<int,long long> o_h; map<int,int> res; map<int,bool> mp; int a,b; for(int i = 0; i < obs; i++){ long long x; cin >> x; // hgt[i] = x; o_h[i+1] = x; } // cout << ...
#include <bits/stdc++.h> using namespace std; int main() { int obs, rd; cin >> obs >> rd; // vector<long long> hgt(obs); map<int, long long> o_h; map<int, int> res; map<int, bool> mp; int a, b; for (int i = 0; i < obs; i++) { long long x; cin >> x; // hgt[i] = x; o_h[i + 1] = x; } ...
[["-", 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, 60]]
1
190
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<long long> vals(n + 1); for (int i = 0; i < n; i++) { cin >> vals[i]; } vector<int> adj[n + 1]; for (int i = 0; i < m; i++) { int p, q; cin >> p >> q; adj[p].push_back(q); adj[q].push_back(...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<long long> vals(n + 1); for (int i = 0; i < n; i++) { cin >> vals[i + 1]; } vector<int> adj[n + 1]; for (int i = 0; i < m; i++) { int p, q; cin >> p >> q; adj[p].push_back(q); adj[q].push_b...
[["+", 0, 16, 12, 69, 341, 342, 0, 16, 17, 72], ["+", 0, 16, 12, 69, 341, 342, 0, 16, 12, 13]]
1
221
n,m = map(int,input().split()) H = list(map(int,input().split())) l = [1] * N for i in range(n): A,B = map(int,input().split()) if H[A-1] > h[B-1]: l[B - 1] = 0 elif H[A - 1] < H[B - 1]: l[A - 1] = 0 elif H[A - 1] == H[B - 1]: l[A - 1], l[B - 1] = 0, 0 print(l.count(1))
N, M = map(int, input().split()) H = list(map(int, input().split())) l = [1] * N for i in range(M): A, B = map(int, input().split()) if H[A - 1] > H[B - 1]: l[B - 1] = 0 elif H[A - 1] < H[B - 1]: l[A - 1] = 0 elif H[A - 1] == H[B - 1]: l[A - 1], l[B - 1] = 0, 0 print(l.count(1))
[["-", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["+", 0, 656, 0, 1, 0, 662, 31, 684, 0, 22], ["-", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["+", 0, 656, 0, 7, 12, 652, 3, 4, 0, 22], ["-", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22], ["+", 8, 196, 0, 57, 15, 666, 0, 206, 51, 22]]
5
151
#include <stdio.h> int main() { int N, M; scanf("%d %d", &N, &M); int H[100002], d[100002]; for (int i = 1; i <= N; i++) { scanf("%d", H + i); d[i] = 1; } int A, B; for (int i = 1; i <= M; i++) { scanf("%d %d", &A, &B); if (H[A] < H[B]) d[A] = 0; else if (H[A] < H[B]) d[B]...
#include <stdio.h> int main() { int N, M; scanf("%d %d", &N, &M); int H[100002], d[100002]; for (int i = 1; i <= N; i++) { scanf("%d", H + i); d[i] = 1; } int A, B; for (int i = 1; i <= M; i++) { scanf("%d %d", &A, &B); if (H[A] < H[B]) d[A] = 0; else if (H[A] > H[B]) d[B]...
[["-", 75, 76, 0, 57, 15, 23, 0, 16, 17, 18], ["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 47]]
0
201
N,M = map(int,input().split()) H = list(map(int,input().split())) max_height = [0]*N for i in range(M): a,b = map(int,input().split()) max_height[a-1]=max(max_height[a-1],H[b-1]) max_height[b-1]=max(max_height[b-1],H[a-1]) print((sum(H[i] >= max_height[i] for i in range(N))))
N,M = map(int,input().split()) H = list(map(int,input().split())) max_height = [0]*N for i in range(M): a,b = map(int,input().split()) max_height[a-1]=max(max_height[a-1],H[b-1]) max_height[b-1]=max(max_height[b-1],H[a-1]) print((sum(H[i] > max_height[i] for i in range(N))))
[["-", 0, 23, 0, 652, 3, 668, 8, 666, 667, 20], ["+", 0, 23, 0, 652, 3, 668, 8, 666, 667, 47]]
5
134
n,k= map(int,input().split()) h=list(map(int,input().split())) x=[0]*n for i in range(k): a,b = map(int, input().split()) if h[a-1]>=h[b-1]: x[a-1]+=1 if h[b-1]>=h[a-1]: x[b-1]+=1 print(x.count(0))
n,k= map(int,input().split()) h=list(map(int,input().split())) x=[0]*n for i in range(k): a,b = map(int, input().split()) if h[a-1]>=h[b-1]: x[b-1] +=1 if h[b-1]>=h[a-1]: x[a-1] +=1 print(x.count(0))
[["-", 0, 1, 0, 677, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 677, 31, 206, 206, 657, 31, 22]]
5
119
#include <bits/stdc++.h> #define ll long long int #define F(i, j, k, in) for (int i = j; i < k; i += in) #define DF(i, j, k, in) for (int i = j; i >= k; i -= in) #define feach(it, l) for (auto it = l.begin(); it != l.end(); ++it) #define fall(a) a.begin(), a.end() #define pb push_back #define ub upper_bound #define lb ...
#include <bits/stdc++.h> #define ll long long int #define F(i, j, k, in) for (int i = j; i < k; i += in) #define DF(i, j, k, in) for (int i = j; i >= k; i -= in) #define feach(it, l) for (auto it = l.begin(); it != l.end(); ++it) #define fall(a) a.begin(), a.end() #define pb push_back #define ub upper_bound #define lb ...
[["-", 51, 16, 31, 69, 341, 342, 0, 69, 28, 22], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 70], ["-", 31, 69, 341, 342, 0, 69, 341, 342, 0, 73]]
1
476
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[a-1]<=H[b-1]: ans[a-1] *= 0 print(sum(ans))
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[a-1]<=H[b-1]: ans[a-1] = 0 print(sum(ans))
[["-", 0, 57, 64, 196, 0, 1, 0, 677, 17, 108], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 0, 32], ["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121], ["-", 75, 665, 64, 196, 0, 1, 0, 677, 17, 108]]
5
117
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [list(map(int, input().split())) for _ in range(m)] ans = [1]*n for i in range(m): if h[ab[i][0]-1] == h[ab[i][1]-1]: ans[ab[i][0]-1] = 0 ans[ab[i][1]-1] = 0 elif h[ab[i][0]-1] > h[ab[i][1]]: ans[ab[i][1]-1] = 0 ...
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [list(map(int, input().split())) for _ in range(m)] ans = [1]*n for i in range(m): if h[ab[i][0]-1] == h[ab[i][1]-1]: ans[ab[i][0]-1] = 0 ans[ab[i][1]-1] = 0 elif h[ab[i][0]-1] > h[ab[i][1]-1]: ans[ab[i][1]-1] = 0 ...
[["+", 75, 665, 15, 666, 0, 206, 206, 657, 17, 33], ["+", 75, 665, 15, 666, 0, 206, 206, 657, 12, 612]]
5
191
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; /*----------macros----------*/ // output================ #define endl '\n' #define fcout cout << fixed << setprecision(15) // typedef=============== typedef long long ll; typedef long double ld; typedef pai...
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; /*----------macros----------*/ // output================ #define endl '\n' #define fcout cout << fixed << setprecision(15) // typedef=============== typedef long long ll; typedef long double ld; typedef pai...
[["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 13]]
1
437
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; #define N 100010 int main() { int n, m; cin >> n >> m; int h[n + 1]; for (int i = 1; i <= n; i++) cin >> h[i]; vector<int> maxx(m + 1); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; maxx[u] = max(...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> using namespace std; #define N 100010 int main() { int n, m; cin >> n >> m; int h[n + 1]; for (int i = 1; i <= n; i++) cin >> h[i]; vector<int> maxx(n + 1); for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; maxx[u] = max(...
[["-", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22], ["+", 0, 43, 49, 50, 51, 4, 0, 16, 31, 22]]
1
175
#include <bits/stdc++.h> using namespace std; vector<int> adj[123456]; vector<int> hs; bool is_good(int x) { for (int node : adj[x]) { if (hs[node] >= hs[x]) return false; } return true; } int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, h; cin >> n >> m >> h; hs.resize(n + 1); ...
#include <bits/stdc++.h> using namespace std; vector<int> adj[123456]; vector<int> hs; bool is_good(int x) { for (int node : adj[x]) { if (hs[node] >= hs[x]) return false; } return true; } int main() { ios::sync_with_stdio(0); cin.tie(0); int n, m, h; cin >> n >> m; hs.resize(n + 1); for ...
[["-", 0, 14, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 14, 8, 9, 0, 1, 0, 16, 12, 22]]
1
207
from collections import deque 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()) a-=1 b-=1 g[a].append(b) g[b].append(a) ans=0 for j in range(n): for i in g[j]: if h[j]<=h[i]: break ...
from collections import deque 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()) a-=1 b-=1 g[a].append(b) g[b].append(a) ans=0 for j in range(n): for i in g[j]: if h[j]<=h[i]: break ...
[["-", 75, 76, 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
142
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; int h[100001]; for (int i = 0; i < n; i++) { cin >> h[i]; } vector<int> G[100001]; while (m--) { int a, b; cin >> a >> b; G[a].push_back(b); G[b].push_back(a); } int ans = 0; for (i...
#include <iostream> #include <vector> using namespace std; int main() { int n, m; cin >> n >> m; int h[100001]; for (int i = 1; i <= n; i++) { cin >> h[i]; } vector<int> G[100001]; while (m--) { int a, b; cin >> a >> b; G[a].push_back(b); G[b].push_back(a); } int ans = 0; for (...
[["-", 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
166
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b; cin >> n >> m; vector<int> h(n + 1); for (int i = 1; i <= n; i++) cin >> h[i]; vector<vector<int>> l(n + 1); for (int i = 0; i < m; i++) { cin >> a >> b; l[a].push_back(b); l[b].push_back(a); } int ans = 0; fo...
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b; cin >> n >> m; vector<int> h(n + 1); for (int i = 1; i <= n; i++) cin >> h[i]; vector<vector<int>> l(n + 1); for (int i = 0; i < m; i++) { cin >> a >> b; l[a].push_back(b); l[b].push_back(a); } int ans = 0; fo...
[["-", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22], ["+", 0, 7, 8, 9, 0, 7, 15, 16, 31, 22]]
1
213
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <stdlib.h> using namespace std; #define INF 1e18 #define PI 3.141592653589793238 typedef long long ll; #define N 100010 int main() { int n, m, h[N], ma[N]; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> h[i]; ma[i] = 0; } ...
#include <algorithm> #include <bits/stdc++.h> #include <iostream> #include <stdlib.h> using namespace std; #define INF 1e18 #define PI 3.141592653589793238 typedef long long ll; #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; }...
[["-", 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
191
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v(n); for (int i = 0; i < n; i++) v[i] = i + 1; vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i]; int a, b; for (int i = 0; i < n; i++) { cin >> a >> b; if (h[a - 1] == h[b - 1]) ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> v(n); for (int i = 0; i < n; i++) v[i] = i + 1; vector<int> h(n); for (int i = 0; i < n; i++) cin >> h[i]; int a, b; for (int i = 0; i < m; i++) { cin >> a >> b; if (h[a - 1] == h[b - 1]) ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
222
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) cnt = n for i in range(n): for j in g[i]: if h[i] <= h[j]: cnt -= 1 break print(cnt)
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) cnt = n for i in range(n): for j in g[i]: if h[i] <= h[j]: cnt -= 1 break print(cnt)
[["-", 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
138
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } vector<int> ans(n, 1); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; if (h[a] >= h[b]) { ...
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; vector<int> h(n); for (int i = 0; i < n; i++) { cin >> h[i]; } vector<int> ans(n, 1); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; if (h[a] >= h[b]) { ...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
186
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n); vector<int> f(m); vector<int> s(m); vector<bool> e(n); int ans = 0; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { cin >> f[i] >> s[i]; } for (int i = 0; i ...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n); vector<int> f(m); vector<int> s(m); vector<bool> e(n); int ans = 0; for (int i = 0; i < n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { cin >> f[i] >> s[i]; } for (int i = 0; i ...
[["+", 8, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 8, 9, 0, 43, 49, 50, 51, 16, 12, 13]]
1
251
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(v) (v).begin(), (v).end() #define sum(v) accumulate(all(v), 0) #define vi vector<int> int main() { int n, m; cin >> n >> m; vi h(n); rep(i, n) { cin >> h[i]; } vi xs(m, 1); rep(i, m) { int a, b;...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) #define all(v) (v).begin(), (v).end() #define sum(v) accumulate(all(v), 0) #define vi vector<int> int main() { int n, m; cin >> n >> m; vi h(n); rep(i, n) { cin >> h[i]; } vi xs(n, 1); rep(i, m) { int a, b;...
[["-", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22], ["+", 8, 9, 0, 43, 49, 50, 51, 4, 0, 22]]
1
175
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; #define rep(i, a, b) for (ll i = a; i < ll(b); i++) #define repr(i, a, b) for (ll i = a; i >= ll(b); i--) #define endl "\n" #define ALL(x) x.begin(), x.end() #define ALLR(x) x.rbegin(...
#include <algorithm> #include <cmath> #include <iostream> #include <string> #include <vector> using namespace std; using ll = long long; #define rep(i, a, b) for (ll i = a; i < ll(b); i++) #define repr(i, a, b) for (ll i = a; i >= ll(b); i--) #define endl "\n" #define ALL(x) x.begin(), x.end() #define ALLR(x) x.rbegin(...
[["-", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78], ["+", 0, 43, 49, 53, 54, 55, 0, 56, 39, 78]]
1
234
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int m = scn.nextInt(); int[] h = new int[n + 1]; for (int i = 0; i < n; i++) { h[i] = scn.nextInt(); } int[] a = new int[m];...
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner scn = new Scanner(System.in); int n = scn.nextInt(); int m = scn.nextInt(); int[] h = new int[n + 1]; for (int i = 1; i <= n; i++) { h[i] = scn.nextInt(); } int[] a = new int[m]...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["-", 0, 195, 8, 196, 0, 7, 15, 16, 17, 18], ["+", 0, 195, 8, 196, 0, 7, 15, 16, 17, 19]]
3
289
N,M=map(int, input().split()) peaks=list(map(int, input().split())) flag=[1]*N a=0 b=0 for i in range(M): a,b=map(int,input().split()) a-=1 b-=1 if peaks[a]<=peaks[b]: flag[a]=0 if peaks[a]>=peaks[b]: flag[a]=0 ans=0 for i in flag: ans+=flag[i] print(ans)
N,M=map(int, input().split()) peaks=list(map(int, input().split())) flag=[1]*N a=0 b=0 for i in range(M): a,b=map(int,input().split()) a-=1 b-=1 if peaks[a]<=peaks[b]: flag[a]=0 if peaks[a]>=peaks[b]: flag[b]=0 ans=0 for i in flag: ans+=i print(ans)
[["-", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["+", 64, 196, 0, 1, 0, 662, 31, 206, 206, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 206, 51, 22], ["-", 8, 196, 0, 1, 0, 677, 12, 206, 0, 70], ["-", 8, 196, 0, 1, 0, 677, 12, 206, 0, 73]]
5
128
import sys import numpy as np from math import ceil as C, floor as F, sqrt from collections import defaultdict as D, Counter as CNT from functools import reduce as R ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' alp = 'abcdefghijklmnopqrstuvwxyz' def _X(): return sys.stdin.readline().rstrip().split(' ') def _S(ss): return tuple...
import sys import numpy as np from math import ceil as C, floor as F, sqrt from collections import defaultdict as D, Counter as CNT from functools import reduce as R ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' alp = 'abcdefghijklmnopqrstuvwxyz' def _X(): return sys.stdin.readline().rstrip().split(' ') def _S(ss): return tuple...
[["+", 3, 668, 8, 666, 0, 206, 206, 657, 17, 33], ["+", 3, 668, 8, 666, 0, 206, 206, 657, 12, 612]]
5
362
n, m = map(int, input().split()) hs = list(map(int, input().split())) edge = [[] for _ in range(n)] for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 edge[a].append(b) edge[b].append(a) print(edge) cnt = 0 for node in range(n): good = True for neighbor in edge[node]: ...
n, m = map(int, input().split()) hs = list(map(int, input().split())) edge = [[] for _ in range(n)] for i in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 edge[a].append(b) edge[b].append(a) cnt = 0 for node in range(n): good = True for neighbor in edge[node]: if hs[n...
[["-", 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
144
n,m=map(int,input().split()) h=list(map(int,input().split())) ab=[[] for nn in range(n)] for mm in range(m): a,b=map(int,input().split()) ab[a-1].append(b-1) ab[b-1].append(a-1) cnt=0 for i in range(n): hi=0 for ll in ab[i]: hi=max(hi,h[ll]) if hi>h[i]: cnt+=1 print(cnt)
n,m=map(int,input().split()) h=list(map(int,input().split())) ab=[[] for nn in range(n)] for mm in range(m): a,b=map(int,input().split()) ab[a-1].append(b-1) ab[b-1].append(a-1) cnt=0 for i in range(n): hi=0 for ll in ab[i]: hi=max(hi,h[ll]) if hi<h[i]: cnt+=1 print(cnt)
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 47], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18]]
5
144
n,m=map(int,input().split()) h=list(map(int,input().split())) ab=[list(map(int,input().split())) for _ in range(m)] list=[0]*n for a,b in ab: list[a-1]+=max(list[a-1],h[b-1]) list[b-1]+=max(list[b-1],h[a-1]) count=0 for i in range(n): if list[i]<h[i]: count+=1 print(count)
n,m=map(int,input().split()) h=list(map(int,input().split())) ab=[list(map(int,input().split())) for _ in range(m)] list=[0]*n for a,b in ab: list[a-1]=max(list[a-1],h[b-1]) list[b-1]=max(list[b-1],h[a-1]) count=0 for i in range(n): if list[i]<h[i]: count+=1 print(count)
[["-", 0, 7, 8, 196, 0, 1, 0, 677, 17, 107], ["+", 0, 7, 8, 196, 0, 1, 0, 662, 0, 32]]
5
148
n,m=map(int,input().split()) a=list(map(int,input().split())) c=0 deg=[[] for i in range(n)] for i in range(m): u,v=map(int,input().split()) deg[u-1].append(v-1) deg[v-1].append(u-1) for i in range(n): ff=0 for j in deg[i]: if(a[i]>a[deg[i][j]]): continue ff=1 if(ff==0): c+=1 print(c)
n,m=map(int,input().split()) a=list(map(int,input().split())) c=0 deg=[[] for i in range(n)] for i in range(m): u,v=map(int,input().split()) deg[u-1].append(v-1) deg[v-1].append(u-1) for i in range(n): ff=0 for j in deg[i]: if(a[i]>a[j]): continue ff=1 if(ff==0): c+=1 print(c)
[["-", 0, 666, 0, 206, 206, 206, 51, 206, 51, 22], ["-", 0, 666, 0, 206, 206, 206, 51, 206, 0, 70], ["-", 0, 666, 0, 206, 206, 206, 51, 206, 206, 22], ["-", 0, 666, 0, 206, 206, 206, 51, 206, 0, 73], ["-", 15, 23, 0, 666, 0, 206, 206, 206, 0, 70], ["-", 15, 23, 0, 666, 0, 206, 206, 206, 0, 73]]
5
155
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ll long long #define ld long double #define oo 2e18 #define OS \ tree<int, null_type, less<int>, rb_tree_tag, ...
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/rope> #define ll long long #define ld long double #define oo 2e18 #define OS \ tree<int, null_type, less<int>, rb_tree_tag, ...
[["-", 0, 7, 8, 9, 0, 57, 75, 76, 0, 95]]
1
247
#include <algorithm> #include <iostream> #include <vector> int main(void) { int N, M, a, b, cnt = 0; std::cin >> N >> M; std::vector<int> H(N + 1, 0), ma(N + 1, 0); for (int i = 1; i <= N; i++) std::cin >> H[i]; for (int i = 0; i < M; i++) { std::cin >> a >> b; ma[a] = std::max(ma[a], H[b]); ...
#include <algorithm> #include <iostream> #include <vector> int main(void) { int N, M, a, b, cnt = 0; std::cin >> N >> M; std::vector<int> H(N + 1, 0), ma(N + 1, 0); for (int i = 1; i <= N; i++) std::cin >> H[i]; for (int i = 0; i < M; i++) { std::cin >> a >> b; ma[a] = std::max(ma[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
187
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { int n, m; cin >> n >> m; vector<int> h(n + 1); for (int i = 1; i <= n; i++) { cin >> h[i]; } vector<vector<int>> grp(n + 1); for (int i = 1; i <= n; i++) { int a, b; cin >> a >> b; grp[a].push_back(b); ...
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { int n, m; cin >> n >> m; vector<int> h(n + 1); for (int i = 1; i <= n; i++) { cin >> h[i]; } vector<vector<int>> grp(n + 1); for (int i = 1; i <= m; i++) { int a, b; cin >> a >> b; grp[a].push_back(b); ...
[["-", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22], ["+", 0, 14, 8, 9, 0, 7, 15, 16, 12, 22]]
1
208
#include <bits/stdc++.h> #define PI acos(-1.0) #define eps 1e-67 #define pf printf #define sf scanf #define sd(n) scanf("%d", &n) #define sd2(n1, n2) scanf("%d %d", &n1, &n2) #define slf(n) scanf("%lf", &n) #define slf2(n1, n2) scanf("%lf %lf", &n1, &n2) #define sLf(n1) scanf("%Lf", &n1) #define sLf2(n1, n2) scanf("%Lf...
#include <bits/stdc++.h> #define PI acos(-1.0) #define eps 1e-67 #define pf printf #define sf scanf #define sd(n) scanf("%d", &n) #define sd2(n1, n2) scanf("%d %d", &n1, &n2) #define slf(n) scanf("%lf", &n) #define slf2(n1, n2) scanf("%lf %lf", &n1, &n2) #define sLf(n1) scanf("%Lf", &n1) #define sLf2(n1, n2) scanf("%Lf...
[["+", 0, 57, 15, 339, 51, 16, 31, 69, 28, 22], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 70], ["+", 15, 339, 51, 16, 31, 69, 341, 342, 0, 73]]
1
548
#include <algorithm> #include <iostream> using namespace std; #define N 100100 int main() { int n, m, h[N], ma[N]; cin >> n >> m; for (int i = 0; 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],...
#include <algorithm> #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],...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13]]
1
173
#!/usr/bin/env python3 n, m = map(int, input().split()) h = [0]+list(map(int, input().split())) ans = [0]+[1]*n for i in range(m): a, b = map(int, input().split()) if h[a]>=h[b]: ans[b] = 0 elif h[b]>=h[a]: ans[a] = 0 print(sum(ans))
n, m = map(int, input().split()) h = [0]+list(map(int, input().split())) ans = [0]+[1]*n for i in range(m): a, b = map(int, input().split()) if h[a]>=h[b]: ans[b] = 0 if h[b]>=h[a]: ans[a] = 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
114
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [list(map(lambda x: x -1, map(int, input().split()))) for _ in range(m)] # 一つづつ展望台を見る必要はなく、道を見て条件に合わないものを除けば良い ans_list = [True] * n for i in range(m): if h[ab[i][0]] >= h[ab[i][1]]: ans_list[ab[i][1]] = False elif h[ab[i][0]] <...
n, m = map(int, input().split()) h = list(map(int, input().split())) ab = [list(map(lambda x: x -1, map(int, input().split()))) for _ in range(m)] # 一つづつ展望台を見る必要はなく、道を見て条件に合わないものを除けば良い ans_list = [True] * n for i in range(m): if h[ab[i][0]] >= h[ab[i][1]]: ans_list[ab[i][1]] = False if h[ab[i][0]] <= ...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
162
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n + 1); for (int i = 1; i <= n; ++i) { cin >> h[i]; } vector<int> g[n + 1]; for (int i = 1; i <= m; ++i) { int u, v; cin >> u >> v; g[u].push_back(v); g[v].push_back(u); } int cnt = 0;...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n + 1); for (int i = 1; i <= n; ++i) { cin >> h[i]; } vector<int> g[n + 1]; for (int i = 1; i <= m; ++i) { int u, v; cin >> u >> v; g[u].push_back(h[v]); g[v].push_back(h[u]); } int cn...
[["+", 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
197
n, m = list(map(int, input().split())) heights = list(map(int, input().split())) flags = [True] * n count = 0 for _ in range(m): roots = list(map(int, input().split())) if heights[roots[0] - 1] > heights[roots[1] - 1]: flags[roots[1] - 1] = False elif heights[roots[0] - 1] < heights[roots[1] - 1]: flags[r...
n, m = list(map(int, input().split())) heights = list(map(int, input().split())) flags = [True] * n count = 0 for _ in range(m): roots = list(map(int, input().split())) if heights[roots[0] - 1] > heights[roots[1] - 1]: flags[roots[1] - 1] = False elif heights[roots[0] - 1] < heights[roots[1] - 1]: flags[r...
[["+", 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
170
n, m = map(int, input().split()) 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[a-1] = 1 if h[a-1] <= h[b-1]: ans[b-1] = 1 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 if h[a-1] <= h[b-1]: ans[a-1] = 0 print(ans.count(1))
[["-", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612], ["+", 0, 1, 0, 662, 12, 657, 31, 634, 0, 612], ["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612]]
5
119
import sys input = sys.stdin.readline def ppp(n,m,h,ab): g = [1] * n for l,r in ab: if h[l-1] >= h[r-1]: g[r-1] = 0 if h[l-1] <= h[r-1]: g[l-1] = 0 print(sum(g)) if __name__ == "__main__": n,m = map(int,input().split()) h = list(map(int,input().split())) ...
import sys input = sys.stdin.readline def ppp(n,m,h,ab): g = [1] * n for l,r in ab: if h[l-1] >= h[r-1]: g[r-1] = 0 if h[l-1] <= h[r-1]: g[l-1] = 0 print(sum(g)) if __name__ == "__main__": n,m = map(int,input().split()) h = list(map(int,input().split())) ...
[["-", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22], ["+", 64, 196, 0, 1, 0, 652, 3, 4, 0, 22]]
5
164
n, m = map(int(input().split())) h = list(map(int, input().split())) p = [1]*n max = 0 for i in range(m): a, b = map(int(input().split())) if h[a-1] <= h[b-1]: p[a-1] = 0 if h[a-1] >= h[b-1]: p[b-1] = 0 print(sum(p))
n, m = map(int, (input().split())) h = list(map(int, input().split())) p = [1]*n max = 0 for i in range(m): a, b = map(int, (input().split())) if h[a-1] <= h[b-1]: p[a-1] = 0 if h[a-1] >= h[b-1]: p[b-1] = 0 print(sum(p))
[["+", 0, 1, 0, 662, 12, 652, 3, 4, 0, 21]]
5
122
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int[] h = new int[n + 1]; int count = 0; int[] ma = new int[n + 1]; for (int i = 0; i <= n; i++) { h[i] = ...
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextInt(); int[] h = new int[n + 1]; int count = 0; int[] ma = new int[n + 1]; for (int i = 1; i <= n; i++) { h[i] = ...
[["-", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499], ["+", 8, 196, 0, 7, 502, 503, 49, 200, 51, 499]]
3
235
#include <iostream> #include <vector> typedef long long ll; using namespace std; int main() { ll n, m, h[100010], a, b, mx[100010], ans = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { cin >> a >> b; mx[a] = (mx[a] < h[b] ? h[b] : mx[a]); mx[b]...
#include <iostream> #include <vector> typedef long long ll; using namespace std; int main() { ll n, m, h[100010], a, b, mx[100010] = {}, ans = 0; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> h[i]; } for (int i = 0; i < m; i++) { cin >> a >> b; mx[a] = (mx[a] < h[b] ? h[b] : mx[a]); ...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 45], ["+", 8, 9, 0, 43, 49, 50, 51, 83, 0, 46], ["-", 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
184
n,m=map(int,input().split()) h=list(map(int,input().split())) x=[i for i in range(n)] for i in range(m): a,b=map(int,input().split()) if h[a-1]>h[b-1]: x[b-1]=0 elif h[a-1]<h[b-1]: x[a-1]=0 else: x[a-1]=0 x[b-1]=0 print(n-x.count(0))
n,m=map(int,input().split()) h=list(map(int,input().split())) x=[i 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]: x[b-1]=0 elif h[a-1]<h[b-1]: x[a-1]=0 else: x[a-1]=0 x[b-1]=0 print(n-x.count(0))
[["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 612], ["+", 12, 658, 0, 659, 12, 652, 3, 4, 0, 21], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 17, 72], ["+", 0, 659, 12, 652, 3, 4, 0, 657, 12, 612]]
5
144
N, M = list(map(int, input().split())) tenbodai = [H for H in list(map(int, input().split()))] tenbodai_trail = [set() for i in range(len(tenbodai))] for _ in range(M): #展望台と繋がる道のリストを作成 trail = list(map(int, input().split())) tenbodai_trail[trail[0] - 1].add(trail[1] - 1) tenbodai_trail[trail[1] - 1].add(t...
N, M = list(map(int, input().split())) tenbodai = [H for H in list(map(int, input().split()))] tenbodai_trail = [set() for i in range(len(tenbodai))] for _ in range(M): #展望台と繋がる道のリストを作成 trail = list(map(int, input().split())) tenbodai_trail[trail[0] - 1].add(trail[1] - 1) tenbodai_trail[trail[1] - 1].add(...
[["-", 0, 7, 8, 196, 0, 57, 15, 666, 667, 18], ["+", 0, 7, 8, 196, 0, 57, 15, 666, 667, 19]]
5
175
N,M = map(int,input().split()) H = list(map(int,input().split())) x = [True] * N for _ in range(M): a,b = map(int,input().split()) if H[a - 1] >= H[b - 1]: x[a - 1] = False if H[b - 1] >= H[a - 1]: x[a - 1] = False print(len([i for i in x if i == True]))
N,M = map(int,input().split()) H = list(map(int,input().split())) x = [True] * N for _ in range(M): a,b = map(int,input().split()) if H[a - 1] >= H[b - 1]: x[b - 1] = False if H[b - 1] >= H[a - 1]: x[a - 1] = False print(len([i for i in x if i == True]))
[["-", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22], ["+", 0, 1, 0, 662, 31, 206, 206, 657, 31, 22]]
5
127
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int h[] = new int[n]; int ma[] = new int[n]; for (int i = 1; i <= n; i++) { h[i] = sc.nextInt(); ma[i] = 0; ...
import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int h[] = new int[n + 1]; int ma[] = new int[n + 1]; for (int i = 1; i <= n; i++) { h[i] = sc.nextInt(); ma[i...
[["+", 49, 200, 51, 227, 497, 505, 0, 16, 17, 72], ["+", 49, 200, 51, 227, 497, 505, 0, 16, 12, 499]]
3
233
N,M=map(int,input().split()) H=list(map(int,input().split())) A=[] for i in range(M): A.append(list(map(int,input().split()))) Q=[0]*N for i in range(M): if H[A[i][0]-1]>=H[A[i][1]-1]: Q[A[i][1]-1]=-10**5 elif H[A[i][0]-1]<=H[A[i][1]-1]: Q[A[i][0]-1]=-10**5 n = sum(x>=0 for x in Q) prin...
N,M=map(int,input().split()) H=list(map(int,input().split())) A=[] for i in range(M): A.append(list(map(int,input().split()))) Q=[0]*N for i in range(M): if H[A[i][0]-1]>=H[A[i][1]-1]: Q[A[i][1]-1]=-10**5 if H[A[i][0]-1]<=H[A[i][1]-1]: Q[A[i][0]-1]=-10**5 n = sum(x>=0 for x in Q) print(...
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
184
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n + 1); vector<int> j(n + 1); for (int i = 1; i <= n; i++) { cin >> h.at(i); j.at(i) = 0; } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; j.at(a) = max(j.at(a), h.at(b)); j.a...
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n + 1); vector<int> j(n + 1); for (int i = 1; i <= n; i++) { cin >> h.at(i); j.at(i) = 0; } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; j.at(a) = max(j.at(a), h.at(b)); j.a...
[["-", 8, 9, 0, 7, 10, 43, 49, 50, 51, 22], ["+", 8, 9, 0, 7, 10, 43, 49, 50, 51, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
202
def main(): n, m = map(int, input().split()) g = [[] for i in range(n+1)] hl = [[] for i in range(n+1)] h = [0] h.extend(list(map(int, input().split()))) for i in range(m): a, b = map(int, input().split()) g[a].append(b) g[b].append(a) g[0].append(0) for i, gi in...
def main(): n, m = map(int, input().split()) g = [[] for i in range(n+1)] hl = [[] for i in range(n+1)] h = [0] h.extend(list(map(int, input().split()))) for i in range(m): a, b = map(int, input().split()) g[a].append(b) g[b].append(a) g[0].append(0) for i, gi in...
[["-", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["+", 0, 14, 8, 196, 0, 1, 0, 662, 31, 22], ["-", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 64, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["+", 8, 196, 0, 1, 0, 652, 63, 319, 500, 22], ["-", 0, 1, 0, 652, 3, 4, 0, 652, 63, 22]...
5
241
N,M = [int(x) for x in input().split()] P = dict([(i,True) for i in range(1,N+1)]) H = [0] + [int(x) for x in input().split()] for m in range(M): A,B = [int(x) for x in input().split()] if H[A] >= H[B]: P[B] = False if H[B] >= H[A]: P[A] = False print(P) print(sum(list(P.values())))
N,M = [int(x) for x in input().split()] P = dict([(i,True) for i in range(1,N+1)]) H = [0] + [int(x) for x in input().split()] for m in range(M): A,B = [int(x) for x in input().split()] if H[A] >= H[B]: P[B] = False if H[B] >= H[A]: P[A] = False print(sum(list(P.values())))
[["-", 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
145
#include <bits/stdc++.h> using namespace std; #define ll long long #define vl vector<ll> #define vi vector<int> #define pi pair<int, int> #define pl pair<ll, ll> #define all(a) a.begin(), a.end() #define mem(a, x) memset(a, x, sizeof(a)) #define pb push_back #define mp make_pair #define F first #define S second #define...
#include <bits/stdc++.h> using namespace std; #define ll long long #define vl vector<ll> #define vi vector<int> #define pi pair<int, int> #define pl pair<ll, ll> #define all(a) a.begin(), a.end() #define mem(a, x) memset(a, x, sizeof(a)) #define pb push_back #define mp make_pair #define F first #define S second #define...
[["-", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["+", 8, 9, 0, 1, 0, 2, 3, 4, 0, 13], ["-", 0, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 0, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
379
#include <bits/stdc++.h> using namespace std; #define N 100010 int main() { int n, m, h[N], ma[N]; //入力 cin >> n >> m; for (int i = 0; i < n; i++) { cin >> h[i]; ma[i] = 0; // 0に初期化 } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; ma[a] = max(ma[a], h[b]); // aと繋がっている展望台の標高の最大値 ...
#include <bits/stdc++.h> using namespace std; #define N 100010 int main() { int n, m, h[N], ma[N]; //入力 cin >> n >> m; //展望台1から入力 for (int i = 1; i <= n; i++) { cin >> h[i]; ma[i] = 0; // 0に初期化 } for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; ma[a] = max(ma[a], h[b]); // aと繋がっ...
[["-", 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
180
#include <bits/stdc++.h> using namespace std; #define N 100010 int main() { int n, m, h[N], ma[N]; cin >> n >> m; for (int i = 0; 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]); } ...
#include <bits/stdc++.h> 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]); } ...
[["-", 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
176
#include <iostream> #include <vector> #define dumpitr(c) \ for (auto itr = c.begin(); itr != c.end(); ++itr) { \ cout << *itr << " "; \ } ...
#include <iostream> #include <vector> #define dumpitr(c) \ for (auto itr = c.begin(); itr != c.end(); ++itr) { \ cout << *itr << " "; \ } ...
[["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 18], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 19]]
1
209
N, M = map(int, input().split()) H = list(map(int, input().split())) l = [1 for i in range(len(H))] A = [] B = [] for _ in range(M): temp = list(map(int, input().split())) A.append(temp[0]) B.append(temp[1]) for i in range(M): if H[A[i]-1] > H[B[i]-1]: l[B[i]-1] = 0 elif H[A[i]-1] < H[B[i]-...
N, M = map(int, input().split()) H = list(map(int, input().split())) l = [0 for i in range(len(H))] A = [] B = [] for _ in range(M): temp = list(map(int, input().split())) A.append(temp[0]) B.append(temp[1]) for i in range(M): if H[A[i]-1] > H[B[i]-1]: l[B[i]-1] = 1 elif H[A[i]-1] < H[B[i]-...
[["-", 0, 656, 0, 1, 0, 662, 12, 658, 8, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 658, 8, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 12, 612], ["-", 75, 76, 8, 196, 0, 1, 0, 662, 12,...
5
207
N, M = map(int, input().split()) c = [0 for _ in range(N)] H = list(map(int, input().split())) for i in range(M): a, b = map(int, input().split()) if H[a-1] < H[b-1]: c[a-1] = 1 elif H[a-1] > H[b-1]: c[b-1] = 1 elif H[a-1] != H[b-1]: c[a-1] = 1 c[b-1] = 1 print(c.count(1))
N, M = map(int, input().split()) c = [1 for _ in range(N)] H = list(map(int, input().split())) for i in range(M): a, b = map(int, input().split()) if H[a-1] < H[b-1]: c[a-1] = 0 elif H[a-1] > H[b-1]: c[b-1] = 0 elif H[a-1] == H[b-1]: c[a-1] = 0 c[b-1] = 0 print(c.count(1))
[["-", 0, 656, 0, 1, 0, 662, 12, 658, 8, 612], ["+", 0, 656, 0, 1, 0, 662, 12, 658, 8, 612], ["-", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 0, 57, 64, 196, 0, 1, 0, 662, 12, 612], ["-", 75, 665, 64, 196, 0, 1, 0, 662, 12, 612], ["+", 75, 665, 64, 196, 0, 1, 0, 662, 12, 612], ["-", 8, 196, 0, 57, 75, 665, 15, 666, ...
5
155
n,m = [int(x) for x in input().split()] H = [int(x) for x in input().split()] g = [ [] for _ in range(n)] for _ in range(m): a,b = [int(x)-1 for x in input().split()] g[a].append(b) g[b].append(a) vis = [False]*n cnt = 0 for i in range(n): if not vis[i]: vis[i] = True gtr =...
n,m = [int(x) for x in input().split()] H = [int(x) for x in input().split()] g = [ [] for _ in range(n)] for _ in range(m): a,b = [int(x)-1 for x in input().split()] g[a].append(b) g[b].append(a) vis = [False]*n cnt = 0 for i in range(n): if not vis[i]: vis[i] = True gtr =...
[["+", 0, 662, 12, 658, 8, 666, 0, 206, 51, 22], ["+", 0, 662, 12, 658, 8, 666, 0, 206, 0, 70], ["+", 0, 662, 12, 658, 8, 666, 0, 206, 0, 73]]
5
174
//#include <math.h> #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #include <iostream> #include <stdio.h> #include <vector> //#include <string.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n); rep(i, n) { cin >> h[i]; } // vector<vector<int>> a(n); ...
//#include <math.h> #include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < (n); i++) #include <iostream> #include <stdio.h> #include <vector> //#include <string.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<int> h(n); rep(i, n) { cin >> h[i]; } // vector<vector<int>> a(n); ...
[["-", 0, 14, 8, 9, 0, 57, 75, 76, 0, 95]]
1
174
N,M = map(int,input().split()) H=list(map(int,input().split())) l = [[]*i for i in range(N)] print(l) for i in range(M): A,B=map(int,input().split()) l[A-1].append(B) l[B-1].append(A) ans=0 for j in range(N): if all(H[elem-1] < H[j] for elem in l[j])==True: ans +=1 print(ans)
N,M = map(int,input().split()) H=list(map(int,input().split())) l = [[]*i for i in range(N)] for i in range(M): A,B=map(int,input().split()) l[A-1].append(B) l[B-1].append(A) ans=0 for j in range(N): if all(H[elem-1] < H[j] for elem in l[j])==True: ans +=1 print(ans)
[["-", 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
141
#include <bits/stdc++.h> using namespace std; class Graph { private: int V; list<int> *adj; public: Graph(int V); void add_edge(int m, int n); int DFS(int s, int a[]); }; Graph::Graph(int v) { V = v; adj = new list<int>[V + 1]; } void Graph::add_edge(int m, int n) { adj[m].push_back(n); adj[n].push_...
#include <bits/stdc++.h> using namespace std; class Graph { private: int V; list<int> *adj; public: Graph(int V); void add_edge(int m, int n); int DFS(int s, int a[]); }; Graph::Graph(int v) { V = v; adj = new list<int>[V + 1]; } void Graph::add_edge(int m, int n) { adj[m].push_back(n); adj[n].push_...
[["-", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["+", 0, 14, 8, 9, 0, 57, 64, 37, 0, 13], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 20], ["+", 8, 9, 0, 57, 15, 339, 51, 16, 17, 47]]
1
337
N, M = map(int, input().split()) H = list(map(int, input().split())) Q = [list(map(int, input().split())) for _ in range(M)] tmp = [0 for _ in range(N)] for i in range(M): if H[Q[i][0]-1] >= H[Q[i][1]-1]: tmp[Q[i][1]-1] = -1 elif H[Q[i][0]-1]<= H[Q[i][1]-1]: tmp[Q[i][0]-1] = -1 print(N + sum(tmp))
N, M = map(int, input().split()) H = list(map(int, input().split())) Q = [list(map(int, input().split())) for _ in range(M)] tmp = [0 for _ in range(N)] for i in range(M): if H[Q[i][0]-1] >= H[Q[i][1]-1]: tmp[Q[i][1]-1] = -1 if H[Q[i][0]-1]<= H[Q[i][1]-1]: tmp[Q[i][0]-1] = -1 print(N + sum(tmp))
[["-", 0, 7, 8, 196, 0, 57, 75, 665, 0, 683], ["+", 0, 656, 0, 7, 8, 196, 0, 57, 0, 121]]
5
172
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() typedef long long ll; #define _GLIBCXX_DEBUG typedef vector<int> vec; typedef vector<ll> lvec; typedef vector<char> cvec; typedef vector<double> dvec;...
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() typedef long long ll; #define _GLIBCXX_DEBUG typedef vector<int> vec; typedef vector<ll> lvec; typedef vector<char> cvec; typedef vector<double> dvec;...
[["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 45], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 17, 60], ["-", 8, 9, 0, 57, 15, 339, 51, 16, 12, 13]]
1
313