input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
########### E
H, W, M = list(map(int, input().split()))
bombs = []
for _ in range(M):
bomb = list([int(x)-1 for x in input().split()])
bombs.append(bomb)
H_list = [0]*H
W_list = [0]*W
sign = True
for h,w in bombs:
H_list[h] += 1
W_list[w] += 1
max_H = [i for i,k in enumerate(H_list) if k... | import sys
H, W, M = list(map(int, input().split()))
bomb = [tuple([int(x) - 1 for x in s.split()]) for s in sys.stdin.readlines()]
X = [0] * H # X:各行の爆破対象の個数
Y = [0] * W # Y:各列の爆破対象の個数
for h, w in bomb:
X[h] += 1
Y[w] += 1
maxX = max(X)
maxY = max(Y)
R = [h for h, x in enumerate(X) if x == ma... | p02580 |
import sys
h,w,m = list(map(int,input().split()))
H = [0]*(h)
W = [0]*(w)
ch = [[False]*w for _ in range(h)]
for _ in range(m):
a,b = list(map(int,input().split()))
H[a-1] += 1
W[b-1] += 1
ch[a-1][b-1] = True
hm = max(H)
wm = max(W)
for i in range(len(H)):
if H[i] != hm:
contin... | import sys
h,w,m = list(map(int,input().split()))
H = [0]*(h)
W = [0]*(w)
ls = []
for _ in range(m):
a,b = list(map(int,input().split()))
ls.append([a-1,b-1])
H[a-1] += 1
W[b-1] += 1
hm = max(H)
wm = max(W)
for i in range(len(H)):
for j in range(len(W)):
if W[j] == wm and H[i] ... | p02580 |
h,w,m=list(map(int,input().split()))
max_h=[0 for i in range(h+1)]
max_w=[0 for i in range(w+1)]
grid=[[0 for i in range(w)] for j in range(h)]
#pro=[list(map(int,input().split())) for i in range(m)]
#pro.sort()
for t in range(m):
#h=pro[t][0]
# w=pro[t][1]
h,w=list(map(int,input().split()))
... | H,W,M=list(map(int,input().split()))
Hx=[] #爆破対象の座標を記録
Hy=[]
X=[]
for i in range(M):
h,w=[int(x)-1 for x in input().split()]
Hx.append(h)
Hy.append(w)
X.append([h,w])
sum_c=[0]*W #縦の合計
sum_r=[0]*H #横の合計
for i in Hy:
sum_c[i] += 1
for j in Hx:
sum_r[j] += 1
max_c=max(sum_c)
... | p02580 |
import collections
H, W, M = list(map(int, input().split()))
h, w = [0]*M, [0]*M
for i in range(M):
h[i], w[i] = list(map(int, input().split()))
counter = collections.Counter(h)
h_max = max(counter.values())
mode_h = [key for key , value in list(counter.items()) if value == h_max]
counter = collection... | import collections
H, W, M = list(map(int, input().split()))
h, w = [0]*M, [0]*M
dic = set()
for i in range(M):
h[i], w[i] = list(map(int, input().split()))
dic.add((h[i],w[i]))
counter = collections.Counter(h)
h_max = max(counter.values())
mode_h = [key for key , value in list(counter.items()) if ... | p02580 |
import sys,bisect
from sys import stdin,stdout
from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right
from math import gcd,ceil,floor,sqrt
from collections import Counter,defaultdict,deque,OrderedDict
from queue import Queue,PriorityQueue
from string import ascii_lowercase... | import sys,bisect
from sys import stdin,stdout
from bisect import bisect_left,bisect_right,bisect,insort,insort_left,insort_right
from math import gcd,ceil,floor,sqrt
from collections import Counter,defaultdict,deque,OrderedDict
from queue import Queue,PriorityQueue
from string import ascii_lowercase... | p02580 |
import sys
input = sys.stdin.readline
h,w,m=list(map(int, input().split()))
from collections import defaultdict
hd=defaultdict(int)
wd=defaultdict(int)
hd2=[[] for i in range(h+1)]
hmax=0
wmax=0
for i in range(m):
h0,w0=list(map(int, input().split()))
hd[h0]+=1
hmax=max(hmax,hd[h0])
hd2[h0]... | import sys
from collections import defaultdict
input = sys.stdin.readline
h,w,m=list(map(int, input().split()))
hd=[0 for i in range(h+1)]
wd=[0 for i in range(w+1)]
hw=defaultdict(int)
hmax=0
wmax=0
for i in range(m):
h0,w0=list(map(int, input().split()))
hd[h0]+=1
hmax=max(hmax,hd[h0])
wd... | p02580 |
h,w,m=list(map(int, input().split()))
from collections import defaultdict
hd=defaultdict(int)
wd=defaultdict(int)
hw=defaultdict(int)
for i in range(m):
h0,w0=list(map(int, input().split()))
hd[h0]+=1
hw[(h0,w0)]+=1
wd[w0]+=1
max_h_list = [kv[0] for kv in list(hd.items()) if kv[1] == max(h... | import sys
from collections import defaultdict
input = sys.stdin.readline
h,w,m=list(map(int, input().split()))
hd=[0 for i in range(h+1)]
wd=[0 for i in range(w+1)]
hw=defaultdict(int)
hmax=0
wmax=0
for i in range(m):
h0,w0=list(map(int, input().split()))
hd[h0]+=1
hmax=max(hmax,hd[h0])
wd... | p02580 |
def main():
import sys
input = sys.stdin.readline
H, W, M = list(map(int, input().split()))
H_list = [[0, i] for i in range(H + 1)]
W_list = [[0, i] for i in range(W + 1)]
S = set()
S_add = S.add
INF = 10 ** 6
for _ in range(M):
a, b = list(map(int, inpu... | def main():
import sys
input = sys.stdin.readline
H, W, M = list(map(int, input().split()))
H_list = [[0, i] for i in range(H + 1)]
W_list = [[0, i] for i in range(W + 1)]
S = set()
S_add = S.add
INF = 10 ** 6
for _ in range(M):
a, b = list(map(int, inpu... | p02580 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
h, w, m = list(map(int, input().split()))
bom_set = set()
h_dict = {}
w_dict = {}
for i in range(m):
hh, ww = list(map(int, input().split()))
bom_set.add(tuple([hh, ww]))
if hh in h_dict:
h_dict[hh] += 1
else:
h_dict[hh] = 1
if ... | #!/usr/bin/python3
# -*- coding: utf-8 -*-
h, w, m = list(map(int, input().split()))
bom_set = set()
h_dict = {}
w_dict = {}
for i in range(m):
hh, ww = list(map(int, input().split()))
bom_set.add(tuple([hh, ww]))
if hh in h_dict:
h_dict[hh] += 1
else:
h_dict[hh] = 1
if ... | p02580 |
#!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(... | #!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(... | p02580 |
#!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(... | #!/usr/bin/env python3
# from typing import Optional
from typing import List
# from typing import Dict
from typing import Tuple
from typing import Set
# from typing import Sequence
Cod = Tuple[int, int]
def main():
args = input().split()
H = int(args[0])
W = int(args[1])
M = int(... | p02580 |
H, W, M = list(map(int, input().split()))
bombs_h = [0] * H
bombs_w = [0] * W
S = [[] for _ in range(H)]
for _ in range(M):
h, w = [int(x)-1 for x in input().split()]
S[h].append(w)
bombs_h[h] += 1
bombs_w[w] += 1
max_h = max(bombs_h)
max_w = max(bombs_w)
hs = [i for i, x in enumerate(bombs... | H, W, M = list(map(int, input().split()))
bombs_h = [0] * H
bombs_w = [0] * W
B = []
for _ in range(M):
h, w = [int(x)-1 for x in input().split()]
B.append((h, w))
bombs_h[h] += 1
bombs_w[w] += 1
max_h = max(bombs_h)
max_w = max(bombs_w)
hs = [i for i, x in enumerate(bombs_h) if x == max_h]... | p02580 |
H, W, M = list(map(int, input().split()))
hk = [[0, i] for i in range(H + 1)]
wk = [[0, j] for j in range(W + 1)]
s = set()
for i in range(M):
h, w = list(map(int, input().split()))
hk[h][0] += 1
wk[w][0] += 1
s.add((h, w))
hk.sort(reverse=True)
wk.sort(reverse=True)
colmax = wk[0][0]
ans = ... | H, W, M = list(map(int, input().split()))
hk = [[0, i] for i in range(H + 1)]
wk = [[0, j] for j in range(W + 1)]
s = set()
for i in range(M):
h, w = list(map(int, input().split()))
hk[h][0] += 1
wk[w][0] += 1
s.add((h, w))
hk.sort(reverse=True)
wk.sort(reverse=True)
colmax = wk[0][0]
ans = ... | p02580 |
from collections import deque
h, w, m = list(map(int, input().split()))
hl=[0]*h
wl=[0]*w
mh=0
mw=0
mhi=deque([])
dic = {}
mwi=deque([])
#ans =[[0]*w for i in range(h)]
s = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
a, b = s[i]
a-=1
b-=1
if not a in dic:
dic[a]... | from collections import deque
h, w, m = list(map(int, input().split()))
hl=[0]*h
wl=[0]*w
mh=0
mw=0
mhi=deque([])
dic = {}
mwi=deque([])
#ans =[[0]*w for i in range(h)]
s = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
a, b = s[i]
a-=1
b-=1
if not a in dic:
dic[a]... | p02580 |
from operator import itemgetter
h, w, m = (int(x) for x in input().split())
H = [0] * h
W = [0] * w
HW = []
for _ in range(m):
h_, w_ = (int(x) - 1 for x in input().split())
HW.append((h_, w_))
H[h_] += 1
W[w_] += 1
hmax = max(H)
wmax = max(W)
hindex = []
windex = []
ans = hmax + wmax - ... | from operator import itemgetter
h, w, m = (int(x) for x in input().split())
H = [0] * h
W = [0] * w
HW = []
for _ in range(m):
h_, w_ = (int(x) - 1 for x in input().split())
HW.append((h_, w_))
H[h_] += 1
W[w_] += 1
hmax = max(H)
wmax = max(W)
hindex = set()
windex = set()
HW.sort(key=... | p02580 |
h,w,m = list(map(int,input().split()))
l = [list(map(int,input().split())) for _ in range(m)]
count_h = [0 for i in range(h)]
count_w = [0 for i in range(w)]
bit = list([0 for i in range(w)] for _ in range(h))
for j,k in l:
count_h[j-1] += 1
count_w[k-1] += 1
bit[j-1][k-1] = 1
h_max = max(count_h)
... | h,w,m = list(map(int,input().split()))
l = [list(map(int,input().split())) for _ in range(m)]
count_h = [0 for i in range(h)]
count_w = [0 for i in range(w)]
for j,k in l:
count_h[j-1] += 1
count_w[k-1] += 1
h_max = max(count_h)
w_max = max(count_w)
h_kouho = []
ko_hh = [0 for _ in range(h)]
ko_w... | p02580 |
from sys import stdin, setrecursionlimit
#input = stdin.buffer.readline
setrecursionlimit(10 ** 7)
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import combinations, permutations, combinations_with_replacement
... | from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
from collections import deque, defaultdict, Counter
H, W, M = list(map(int, input().split()))
hw = [list(map(int, input().split())) for _ in range(M)]
cnt = defaultdict(int)
cnt_h = defaultdict(int)
cnt_w = defaultdict(int)
for h, w ... | p02580 |
import sys
HK,WK,M = list(map(int, input().split()))
W = [0] * (WK + 1)
H = [0] * (HK + 1)
HW = [[0 for i in range(WK+1)] for _ in range(HK+1)]
# 3*10^5
for i in range(M):
h, w = list(map(int, input().split()))
H[h] += 1
W[w] += 1
HW[h][w] = 1
answer = 0
HMAX = max(H)
WMAX = max(W)
... | import sys
HK,WK,M = list(map(int, input().split()))
W = [0] * (WK + 1)
H = [0] * (HK + 1)
HW = {}
# 3*10^5
for i in range(M):
h, w = list(map(int, input().split()))
H[h] += 1
W[w] += 1
HW[(h,w)] = 1
answer = 0
HMAX = max(H)
WMAX = max(W)
HEMAX = H.count(HMAX)
WEMAX = W.count(WM... | p02580 |
def find():
h,w,m=list(map(int,input().split()))
idx=[]
for i in range(m):
var=list(map(int,input().split()))
idx.append(var)
r={}
c={}
maze=[[0 for j in range(w)]for i in range(h)]
for i in idx:
maze[i[0]-1][i[1]-1]=1
r.setdefault(i[0]-1,0)
... | def find():
h,w,m=list(map(int,input().split()))
idx=[]
for i in range(m):
var=list(map(int,input().split()))
idx.append(var)
r={}
c={}
#maze=[[0 for j in range(w)]for i in range(h)]
mz={}
for i in idx:
mz.setdefault((i[0]-1,i[1]-1),0)
mz[(i[... | p02580 |
from collections import Counter
from itertools import groupby
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def ilen(ll):
return sum(1 for _ in ll)
def solve():
H, W, M = read_ints()
hw = []
for _ in rang... | from collections import Counter
from itertools import groupby
def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split(' ')))
def ilen(ll):
return sum(1 for _ in ll)
def solve():
H, W, M = read_ints()
hw = []
for _ in rang... | p02580 |
H, W, M = list(map(int, input().split()))
hlist = [0] * H
wlist = [0] * W
hw = [[0 for _ in range(W)] for _ in range(H)]
for i in range(M):
h, w = list(map(int, input().split()))
hlist[h - 1] += 1
wlist[w - 1] += 1
hw[h - 1][w - 1] = 1
hmax = max(hlist)
wmax = max(wlist)
hmaxlist = [i for i... | H, W, M = list(map(int, input().split()))
hlist = [0] * H
wlist = [0] * W
hw = set()
for i in range(M):
h, w = list(map(int, input().split()))
hlist[h - 1] += 1
wlist[w - 1] += 1
hw.add((h - 1, w - 1))
hmax = max(hlist)
wmax = max(wlist)
hmaxlist = [i for i, v in enumerate(hlist) if v == hm... | p02580 |
def main():
H, W, M = (int(i) for i in input().split())
hc = [0]*(H+1)
wc = [0]*(W+1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = -1
maw = -1
hmaps = set()
wmaps = s... | def main():
H, W, M = (int(i) for i in input().split())
hc = [0]*(H+1)
wc = [0]*(W+1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = -1
maw = -1
hmaps = set()
wmaps = s... | p02580 |
def main():
H, W, M = (int(i) for i in input().split())
hc = [0]*(H+1)
wc = [0]*(W+1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = -1
maw = -1
hmaps = set()
wmaps = s... | def main():
H, W, M = (int(i) for i in input().split())
hc = [0]*(H+1)
wc = [0]*(W+1)
maps = set()
for _ in range(M):
h, w = (int(i) for i in input().split())
hc[h] += 1
wc[w] += 1
maps.add((h, w))
mah = max(hc)
maw = max(wc)
ans = mah+maw
... | p02580 |
def main():
h, w, m = list(map(int, input().split()))
bombs_h = [0] * h
bombs_w = [0] * w
B = []
for n in range(m):
h1, w1 = list(map(int, input().split()))
B.append((h1-1, w1-1))
bombs_w[w1-1] += 1
bombs_h[h1-1] += 1
h_maxindex = [i for i, x in enumerat... | def main():
h, w, m = list(map(int, input().split()))
bombs_h = [0] * h
bombs_w = [0] * w
B = []
for n in range(m):
h1, w1 = [int(x)-1 for x in input().split()]
B.append((h1, w1))
bombs_w[w1] += 1
bombs_h[h1] += 1
max_h = max(bombs_h)
max_w = max(bo... | p02580 |
h,w,m = list(map(int,input().split()))
hw = [list(map(int,input().split())) for _ in range(m)]
hc = [0]*h
wc = [0]*w
d={}
for _h, _w in hw:
hc[_h-1]+=1
wc[_w-1]+=1
d[(_h-1,_w-1)]=1
maxh = max(hc)
maxw = max(wc)
hoge = True
wi = [i for i in range(w) if wc[i]==maxw]
for h in [i for ... | h,w,m = list(map(int,input().split()))
hw = [list(map(int,input().split())) for _ in range(m)]
hc = [0]*h
wc = [0]*w
d={}
for _h, _w in hw:
hc[_h-1]+=1
wc[_w-1]+=1
d[(_h-1,_w-1)]=1
maxh = max(hc)
maxw = max(wc)
hoge = True
wi = [i for i in range(w) if wc[i]==maxw]
for h ... | p02580 |
H, W, M = [int(v) for v in input().split()]
targets = []
for _ in range(M):
targets.append([int(v) for v in input().split()])
grid = []
for _ in range(H):
grid.append([0] * W)
for x, y in targets:
for i in range(H):
grid[i][y-1] += 1
for j in range(W):
grid[x-1][... | H, W, M = [int(v) for v in input().split()]
targets = []
for _ in range(M):
targets.append([int(v) - 1 for v in input().split()])
h_count = [0] * H
w_count = [0] * W
for x, y in targets:
h_count[x] += 1
w_count[y] += 1
h_count_max = max(h_count)
max_val = -1
for i in range(H):
... | p02580 |
import sys
def resolve(in_):
H, W, M = list(map(int, next(in_).split()))
targets = tuple(tuple(map(int, line.split())) for line in in_)
# H, W, M = 3, 3, 3
# targets = ((1, 1), (2, 1), (1, 3))
target_h = {}
target_w = {}
target_hw = set()
for h, w in targets:
ta... | import sys
import itertools
def resolve(in_):
H, W, M = list(map(int, next(in_).split()))
targets = tuple(tuple(map(int, line.split())) for line in in_)
target_h = {}
target_w = {}
target_hw = set()
for h, w in targets:
target_h[h] = target_h.setdefault(h, 0) + 1
... | p02580 |
H, W, M = list(map(int, input().split()))
targets = [list(map(int, input().split())) for _ in range(M)]
x_counter = [0 for _ in range(W + 1)]
y_counter = [0 for _ in range(H + 1)]
y_index = []
x_index = []
check = 0
for i in range(M):
x, y = targets[i]
y_counter[x] += 1
x_counter[y] += 1
y_ma... | h,w,m=list(map(int,input().split()))
item=[list(map(int,input().split())) for i in range(m)]
row=[0]*h
col=[0]*w
for i in range(m):
x,y=item[i]
row[x-1]+=1
col[y-1]+=1
mr,mc=max(row),max(col)
xr=set([i for i in range(h) if row[i]==mr])
xc=set([i for i in range(w) if col[i]==mc])
check=len(xr)*len... | p02580 |
import sys
from collections import Counter
def main():
input = sys.stdin.buffer.readline
h, w, m = list(map(int, input().split()))
h = [0] * m
w = [0] * m
object_set = set()
for i in range(m):
h[i], w[i] = list(map(int, input().split()))
object_set.add((h[i], w[i]))... | import sys
from collections import Counter
def main():
input = sys.stdin.buffer.readline
h, w, m = list(map(int, input().split()))
h = [0] * m
w = [0] * m
object_set = set()
for i in range(m):
h[i], w[i] = list(map(int, input().split()))
object_set.add((h[i], w[i]))... | p02580 |
from collections import defaultdict as dd
h, w, m = list(map(int, input().split()))
#dic[row, col] -> set(ids)
h_dic = dd(set)
w_dic = dd(set)
spot = set()
for i in range(m):
h_c, w_c = list(map(int, input().split()))
h_dic[h_c].add(i)
w_dic[w_c].add(i)
spot.add((h_c, w_c))
#print(h_dic, ... | from sys import exit
from collections import defaultdict as dd
h, w, m = list(map(int, input().split()))
#dic[row, col] -> set(ids)
h_dic = dd(int)
w_dic = dd(int)
spot = set()
for i in range(m):
h_c, w_c = list(map(int, input().split()))
h_dic[h_c] += 1
w_dic[w_c] += 1
spot.add((h_c, w_c... | p02580 |
# -*- coding: utf-8 -*-
# E
import sys
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline
# 再起回数上限変更
# sys.setrecursionlimit(1000000)
H, W, M = list(map(int, input().split()))
h = [] * M
w = [] * M
dic_combi = d... | # -*- coding: utf-8 -*-
# E
import sys
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline
# 再起回数上限変更
# sys.setrecursionlimit(1000000)
H, W, M = list(map(int, input().split()))
h = [] * M
w = [] * M
dic_combi = d... | p02580 |
H, W, M = list(map(int, input().split()))
m = [[False] * W for _ in range(H)]
dh = dict()
dw = dict()
for _ in range(M):
h_, w_ = list(map(int, input().split()))
m[h_ - 1][w_ - 1] = True
if h_ in dh:
dh[h_] += 1
else:
dh[h_] = 1
if w_ in dw:
dw[w_]... | H, W, M = list(map(int, input().split()))
boms = []
h, w = [0] * (H + 1), [0] * (W + 1)
for _ in range(M):
h_, w_ = list(map(int, input().split()))
boms.append([h_, w_])
h[h_] += 1
w[w_] += 1
hmax = max(h)
wmax = max(w)
cnt = h.count(hmax) * w.count(wmax)
for hh, ww in boms:
if hmax ... | p02580 |
h,w,m = list(map(int,input().split()))
p = [[0 for i in range(w)]for i in range(h)]
hlist = [0 for i in range(h)]
wlist = [0 for i in range(w)]
for i in range(m):
a,b = list(map(int,input().split()))
hlist[a-1] += 1
wlist[b-1] += 1
p[a-1][b-1] = 1
q = 0
for i in range(h):
q = max(q,hlist[... | h,w,m = list(map(int,input().split()))
p = []
hlist = [0 for i in range(h)]
wlist = [0 for i in range(w)]
for i in range(m):
a,b = list(map(int,input().split()))
hlist[a-1] += 1
wlist[b-1] += 1
p.append([a-1,b-1])
q = 0
for i in range(h):
q = max(q,hlist[i])
s = []
for i in range(h):
... | p02580 |
from collections import defaultdict
H, W, M = list(map(int, input().split()))
r = defaultdict(int)
c = defaultdict(int)
rc = defaultdict(int)
for i in range(M):
h, w = list(map(int, input().split()))
rc[(h, w)] += 1
r[w] += 1
c[h] += 1
ri, rmax = 0, 0
ci, cmax = 0, 0
for i in list(r.keys()... | H, W, M = list(map(int, input().split()))
r = [0]*(W+1)
c = [0]*(H+1)
rc = {}
for i in range(M):
h, w = list(map(int, input().split()))
rc[(h, w)] = True
r[w] += 1
c[h] += 1
rm = max(r)
cm = max(c)
ri = {i for i, v in enumerate(r) if v == rm}
ci = {i for i, v in enumerate(c) if v == cm}
... | p02580 |
from collections import Counter
from collections import defaultdict
def li():
return [int(x) for x in input().split()]
H, W, M = li()
PH = []
PW = []
PF = defaultdict(int)
for i in range(M):
h, w = li()
PH.append(h)
PW.append(w)
PF[h, w] += 1
frequency_h_list = Counter(PH).most_... | from collections import Counter
from collections import defaultdict
def li():
return [int(x) for x in input().split()]
H, W, M = li()
PH = []
PW = []
PF = defaultdict(int)
for i in range(M):
h, w = li()
PH.append(h)
PW.append(w)
PF[h, w] += 1
frequency_h_list = Counter(PH).most_... | p02580 |
h,w,m=list(map(int,input().split()))
hlist=[0]*(h+1)
wlist=[0]*(w+1)
cnt=[]
for i in range(m):
a,b=list(map(int,input().split()))
hlist[a]+=1
wlist[b]+=1
cnt.append([a,b])
hcnt,wcnt=max(hlist),max(wlist)
hhh=[i for i,v in enumerate(hlist) if v==hcnt]
www=[i for i,v in enumerate(wlist) if ... | h,w,m=list(map(int,input().split()))
hlist=[0]*(h+1)
wlist=[0]*(w+1)
cnt=set()
for i in range(m):
a,b=list(map(int,input().split()))
hlist[a]+=1
wlist[b]+=1
cnt.add((a,b))
hcnt,wcnt=max(hlist),max(wlist)
hhh=[i for i,v in enumerate(hlist) if v==hcnt]
www=[i for i,v in enumerate(wlist) if ... | p02580 |
h,w,m=list(map(int,input().split()))
hlist=[0]*(h+1)
wlist=[0]*(w+1)
cnt=set()
for i in range(m):
a,b=list(map(int,input().split()))
hlist[a]+=1
wlist[b]+=1
cnt.add((a,b))
hcnt,wcnt=max(hlist),max(wlist)
hhh=[i for i,v in enumerate(hlist) if v==hcnt]
www=[i for i,v in enumerate(wlist) if ... | h,w,m=list(map(int,input().split()))
hlist=[0]*(h+1)
wlist=[0]*(w+1)
cnt=set()
for i in range(m):
a,b=list(map(int,input().split()))
hlist[a]+=1
wlist[b]+=1
cnt.add((a,b))
hcnt,wcnt=max(hlist),max(wlist)
hhh=[i for i,v in enumerate(hlist) if v==hcnt]
www=[i for i,v in enumerate(wlist) if ... | p02580 |
h,w,m=list(map(int,input().split()))
hlis=[0 for i in range(h)]
wlis=[0 for i in range(w)]
lis=[[0 for _ in range(w)] for _ in range(h)]
for i in range(m):
hi,wi=list(map(int,input().split()))
hlis[hi-1]+=1
wlis[wi-1]+=1
lis[hi-1][wi-1]+=1
hmax=max(hlis)
wmax=max(wlis)
ph=[]
pw=[]
for i i... | import sys
h,w,m=list(map(int,input().split()))
hlis=[0 for i in range(h)]
wlis=[0 for i in range(w)]
hw=[]
for i in range(m):
hi,wi=list(map(int,input().split()))
hlis[hi-1]+=1
wlis[wi-1]+=1
hw.append([hi-1,wi-1])
hmax=max(hlis)
wmax=max(wlis)
ph=[]
pw=[]
for i in range(h):
if hlis... | p02580 |
import itertools
H, W, M = list(map(int, input().split()))
row=[0]*H
col=[0]*W
mat=[[0 for i in range(W)] for j in range(H)]
for i in range(M):
h, w = list(map(int, input().split()))
h-=1
w-=1
row[h]+=1
col[w]+=1
mat[h][w]+=1
r=max(row)
c=max(col)
rr=[i for i in range(H) if row[i]==r]
... | H, W, M = list(map(int, input().split()))
row=[0]*H
col=[0]*W
mat=[]
for i in range(M):
h, w = list(map(int, input().split()))
row[h-1]+=1
col[w-1]+=1
mat.append((h-1,w-1))
r=max(row)
c=max(col)
rr=[1 if row[i]==r else 0 for i in range(H)]
cc=[1 if col[i]==c else 0 for i in range(W)]
x=... | p02580 |
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
... | import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
... | p02580 |
H, W, M = list(map(int, input().split()))
HW = list(tuple(int(x) - 1 for x in input().split()) for _ in range(M))
h = [0] * H
w = [0] * W
for hi, wi in HW:
h[hi] += 1
w[wi] += 1
hm = max(h)
wm = max(w)
hh = [i for i, v in enumerate(h) if v == hm]
ww = [i for i, v in enumerate(w) if v == wm]
ans = hm + ... | H, W, M = list(map(int, input().split()))
HW = set(tuple(int(x) - 1 for x in input().split()) for _ in range(M))
h = [0] * H
w = [0] * W
for hi, wi in HW:
h[hi] += 1
w[wi] += 1
hm = max(h)
wm = max(w)
hh = [i for i, v in enumerate(h) if v == hm]
ww = [i for i, v in enumerate(w) if v == wm]
ans = hm + w... | p02580 |
from collections import defaultdict
def get_keys_of_max_value(d):
v_max = 0
keys = []
for k, v in list(d.items()):
if v_max < v:
v_max = v
keys = [k]
elif v_max == v:
keys.append(k)
return keys, v_max
h, w, m = list(map(int, input().spli... | from collections import defaultdict
def get_keys_of_max_value(d):
v_max = 0
keys = []
for k, v in list(d.items()):
if v_max < v:
v_max = v
keys = [k]
elif v_max == v:
keys.append(k)
return keys, v_max
h, w, m = list(map(int, input().spli... | p02580 |
from collections import Counter
H, W, M = list(map(int, input().split()))
h = [0] * M
w = [0] * M
for i in range(M):
h[i], w[i] = list(map(int, input().split()))
S = Counter(h)
T = Counter(w)
if (S.most_common()[0][1] > T.most_common()[0][1]):
for i in range(M):
if (h[i] == S.most_comm... | from collections import Counter
import sys
H, W, M = list(map(int, input().split()))
h = [0] * M
w = [0] * M
for i in range(M):
h[i], w[i] = list(map(int, input().split()))
S = Counter(h)
T = Counter(w)
if (M == 1):
print((1))
else:
if (S.most_common()[0][1] > T.most_common()[0][1]):
... | p02580 |
H, W, M = list(map(int, input().split()))
A = [0]*H
B = [0]*W
D = set()
for _ in range(M):
h,w = list(map(int, input().split()))
A[h-1] += 1
B[w-1] += 1
D.add((h-1,w-1))
a, b = max(A), max(B)
res = a+b-1
for i in range(H):
for j in range(W):
if (A[i],B[j]) == (a,b):
... | H, W, M = list(map(int, input().split()))
A = [0]*H
B = [0]*W
D = set()
for _ in range(M):
h,w = list(map(int, input().split()))
A[h-1] += 1
B[w-1] += 1
D.add((h-1,w-1))
a, b = max(A), max(B)
res = a+b-1
E, F = [], []
for i in range(H):
if A[i] == a:
E.append(i)
for j in range... | p02580 |
H, W, M = list(map(int, input().split()))
h = [0] * (H+1)
w = [0] * (W+1)
l = set()
for i in range(M):
x, y = list(map(int, input().split()))
h[x] += 1
w[y] += 1
l.add((x, y))
a = [i for i, x in enumerate(h) if x == max(h)]
b = [i for i, x in enumerate(w) if x == max(w)]
flag = False
for s in ... | H, W, M = list(map(int, input().split()))
h = [0] * (H+1)
w = [0] * (W+1)
l = set()
for i in range(M):
x, y = list(map(int, input().split()))
h[x] += 1
w[y] += 1
l.add((x, y))
c = max(h)
d = max(w)
a = [i for i, x in enumerate(h) if x == c]
b = [i for i, x in enumerate(w) if x == d]
flag = Fa... | p02580 |
h,w,n=list(map(int,input().split()))
H=[0]*h
W=[0]*w
L=[[0 for i in range(w)] for i in range(h)]
for i in range(n):
a,b=list(map(int,input().split()))
L[a-1][b-1]=1
H[a-1]+=1
W[b-1]+=1
h_max=max(H)
w_max=max(W)
H_max=[i+1 for i, x in enumerate(H) if x == h_max]
W_max=[i+1 for i, x in enumera... | h,w,n=list(map(int,input().split()))
H=[0]*h
W=[0]*w
L=[(0,0)]*n
for i in range(n):
a,b=list(map(int,input().split()))
L[i]=(a,b)
H[a-1]+=1
W[b-1]+=1
h_max=max(H)
w_max=max(W)
ans=h_max+w_max
cnt=0
for l in L:
if H[l[0]-1]==h_max and W[l[1]-1]==w_max:
cnt+=1
if H.count(h_max)... | p02580 |
import sys
readline = sys.stdin.buffer.readline
from collections import defaultdict
dic1 = defaultdict(int)
def even(n): return 1 if n%2==0 else 0
H,W,M = list(map(int,readline().split()))
columns = [0]*W
row = [0]*H
for i in range(M):
h,w = list(map(int,readline().split()))
h,w = h-1,w-1
... | import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
H,W,M = list(map(int,readline().split()))
col = [0]*W
row = [0]*H
elements = []
for i in range(M):
h,w = list(map(int,readline().split()))
h,w = h-1,w-1
elements.append((h,w))
col[w] += 1
row[h] ... | p02580 |
h,w,m=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in range(m)]
b,c=[0]*h,[0]*w
for t1,t2 in a:
b[t1-1]+=1
c[t2-1]+=1
bm,cm=max(b),max(c)
b1,c1=[],[]
d=[]
for x,y in a:
d.append((x-1,y-1))
d=set(d)
for i in range(h):
if b[i]==bm:
b1.append(i)
for i in ran... | h,w,m=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in range(m)]
b,c=[0]*h,[0]*w
for t1,t2 in a:
b[t1-1]+=1
c[t2-1]+=1
bm,cm=max(b),max(c)
b1,c1=[],[]
d=[]
for x,y in a:
d.append((x-1,y-1))
d=set(d)
for i in range(h):
if b[i]==bm:
b1.append(i)
for i in ran... | p02580 |
import pprint
H, W, M = list(map(int, input().split()))
bombs = set()
hCount = [0]*H
vCount = [0]*W
for i in range(M):
h, w = list(map(int, input().split()))
h -= 1; w -= 1;
hCount[h] += 1
vCount[w] += 1
bombs.add((h, w))
hMax = max(hCount)
vMax = max(vCount)
hMaxIndex = [i for i, x... | import pprint
H, W, M = list(map(int, input().split()))
bombs = set()
hCount = [0]*H
vCount = [0]*W
for i in range(M):
h, w = list(map(int, input().split()))
h -= 1; w -= 1;
hCount[h] += 1
vCount[w] += 1
bombs.add((h, w))
hMax = max(hCount)
vMax = max(vCount)
hMaxIndex = [i for i, x... | p02580 |
H, W, M = list(map(int, input().split()))
bomb = [tuple([int(a) - 1 for a in input().split()]) for _ in range(M)]
cntRow = [0] * H
cntCol = [0] * W
for h, w in bomb:
cntRow[h] += 1
cntCol[w] += 1
mxR = max(cntRow)
mxC = max(cntCol)
R = set([h for h in range(H) if cntRow[h] == mxR])
C = set([w fo... | H, W, M = list(map(int, input().split()))
bombs = set([tuple(map(int, input().split())) for _ in range(M)])
cntH = [0] * (H + 1)
cntW = [0] * (W + 1)
for h, w in bombs:
cntH[h] += 1
cntW[w] += 1
mxH = max(cntH)
mxW = max(cntW)
ans = mxH + mxW - 1
mxH = [h for h in range(1, H + 1) if cntH[h] ==... | p02580 |
import sys
input = sys.stdin.readline
def main():
ans = 0
H, W, M = list(map(int, input().split()))
bombs = []
hs = [0]*(H)
ws = [0]*(W)
for _ in range(M):
h, w = list(map(int, input().split()))
bombs.append([h-1, w-1])
hs[h-1] += 1
ws[w-1] += 1
... | import sys
input = sys.stdin.readline
def main():
ans = 0
H, W, M = list(map(int, input().split()))
bombs = []
hs = [0]*(H)
ws = [0]*(W)
for _ in range(M):
h, w = list(map(int, input().split()))
bombs.append(tuple([h-1, w-1]))
hs[h-1] += 1
ws[w-1] ... | p02580 |
import sys
input = sys.stdin.readline
def main():
ans = 0
H, W, M = list(map(int, input().split()))
bombs = []
hs = [0]*(H)
ws = [0]*(W)
for _ in range(M):
h, w = list(map(int, input().split()))
bombs.append(tuple([h-1, w-1]))
hs[h-1] += 1
ws[w-1] ... | import sys
input = sys.stdin.readline
def main():
ans = 0
H, W, M = list(map(int, input().split()))
bombs = []
hs = [0]*(H)
ws = [0]*(W)
for _ in range(M):
h, w = list(map(int, input().split()))
bombs.append(tuple([h-1, w-1]))
hs[h-1] += 1
ws[w-1] ... | p02580 |
h,w,m = list(map(int, input().split()))
hl = [0] * h
wl = [0] * w
dic = set()
for i in range(m):
x,y = list(map(int, input().split()))
dic.add((x,y))
hl[x-1] += 1
wl[y-1] += 1
h_max = max(hl)
r = [i for i in range(h) if hl[i] == h_max]
w_max = max(wl)
c = [i for i in range(w) if wl[i] == w_max]
... | def main():
h,w,m = list(map(int, input().split()))
hl = [0] * h
wl = [0] * w
dic = set()
for i in range(m):
x,y = list(map(int, input().split()))
dic.add((x,y))
hl[x-1] += 1
wl[y-1] += 1
h_max = max(hl)
r = [i for i in range(h) if hl[i] == h_max]
w_max = max(wl)
c = [i ... | p02580 |
h,w,m=list(map(int, input().split()))
hw=[list(map(int, input().split())) for _ in range(m)]
tate=[]
yoko=[]
for i in range(m):
tate.append(hw[i][0])
yoko.append(hw[i][1])
from collections import Counter
tatec=Counter(tate).most_common()
yokoc=Counter(yoko).most_common()
c_1_max=tatec[0][1]
c... | h,w,m=list(map(int, input().split()))
hw=[list(map(int, input().split())) for _ in range(m)]
y_list=[0]*h
x_list=[0]*w
for h_i, w_i in hw:
y_list[h_i-1]+=1
x_list[w_i-1]+=1
my_cnt=max(y_list)
mx_cnt=max(x_list)
y_cnt=0
x_cnt=0
my_set=set()
mx_set=set()
for h_i, w_i in hw:
if y_list... | p02580 |
h,w,m=list(map(int,input().split()))
r=dict()
c=dict()
pos=[]
rmax=0
cmax=0
for i in range(m):
row,col=list(map(int,input().split()))
if(row in r):
r[row]+=1
rmax=max(r[row],rmax)
else:
r[row]=1
rmax=max(r[row],rmax)
if(col in c):
c[col]+=1
... | h,w,m=list(map(int,input().split()))
row=[0 for i in range(h)]
col=[0 for i in range(w)]
a=[]
for i in range(m):
r,c=[int(x)-1 for x in input().split()]
a.append([r,c])
row[r]+=1
col[c]+=1
rmax=max(row)
cmax=max(col)
ans=rmax+cmax
flag=row.count(rmax)*col.count(cmax)
for i,j in a:
if(r... | p02580 |
import sys
from collections import deque
def input():
return sys.stdin.readline().rstrip()
def main():
H, W, M = list(map(int, input().split()))
lh = [0] * H
lw = [0] * W
s = set()
for _ in range(M):
h, w = list(map(int, input().split()))
lh[h - 1] += 1
... | import sys
from collections import deque
def input():
return sys.stdin.readline().rstrip()
def main():
H, W, M = list(map(int, input().split()))
lh = [0] * H
lw = [0] * W
s = set()
for _ in range(M):
h, w = list(map(int, input().split()))
lh[h - 1] += 1
... | p02580 |
import collections
h, w, m = list(map(int, input().split()))
x = []
y = []
bomb = []
for i in range(m):
tmp_x, tmp_y = list(map(int, input().split()))
x.append(tmp_x)
y.append(tmp_y)
bomb.append([tmp_x, tmp_y])
c_x = collections.Counter(x)
c_y = collections.Counter(y)
_max_x = c_x.most_common()[... | h,w,n=list(map(int,input().split()))
H=[0]*h
W=[0]*w
L=[(0,0)]*n
for i in range(n):
a,b=list(map(int,input().split()))
L[i]=(a,b)
H[a-1]+=1
W[b-1]+=1
h_max=max(H)
w_max=max(W)
ans=h_max+w_max
cnt=0
for l in L:
if H[l[0]-1]==h_max and W[l[1]-1]==w_max:
cnt+=1
if H.count(h_max)... | p02580 |
import heapq
H, W, M = list(map(int, input().split()))
bn_h = {}
bn_v = {}
for i in range(M):
h, w = list(map(int, input().split()))
bn_h.setdefault(h, set())
bn_h[h].add(w)
bn_v.setdefault(w, set())
bn_v[w].add(h)
b1 = sorted(list(bn_h.items()), key = lambda x:len(x[1]), reverse=T... | import heapq
def main():
H, W, M = list(map(int, input().split()))
bn_h = {}
bn_v = {}
for i in range(M):
h, w = list(map(int, input().split()))
bn_h.setdefault(h, set())
bn_h[h].add(w)
bn_v.setdefault(w, set())
bn_v[w].add(h)
b1 = sorted(list... | p02580 |
h, w, m = list(map(int, input().split()))
bord_x, bord_y = [0 for i in range(h)], [0 for i in range(w)]
bord = [[0 for _j in range(w)] for _i in range(h)]
hw = []
for _i in range(m):
s, t = list(map(int, input().split()))
s -= 1
t -= 1
bord_x[s] += 1
bord_y[t] += 1
hw.append([s, t])
... | h, w, m = list(map(int, input().split()))
bord_x, bord_y = [0]*h, [0]*w
hw = []
for _i in range(m):
s, t = list(map(int, input().split()))
s -= 1
t -= 1
bord_x[s] += 1
bord_y[t] += 1
hw.append([s, t])
x_max, y_max = max(bord_x), max(bord_y)
cnt = 0
for i, j in hw:
if bo... | p02580 |
H, W, M = list(map(int, input().split()))
h = [0 for i in range(H)]
w = [0 for i in range(W)]
dp = [[0 for i in range(W)] for j in range(H)]
for i in range(M):
hh, ww = list(map(int, input().split()))
dp[hh - 1][ww - 1] += 1
for i in range(H):
h[i] = sum(dp[i])
for i in range(W):
w[i] = ... | H, W, M = list(map(int, input().split()))
h = [0 for i in range(H)]
w = [0 for i in range(W)]
DP = []
for i in range(M):
hh, ww = list(map(int, input().split()))
h[hh - 1] += 1
w[ww - 1] += 1
DP.append((hh - 1, ww - 1))
hhh = max(h)
www = max(w)
hhhh = [i for i, x in enumerate(h) if x == hh... | p02580 |
import sys
h,w,m = list(map(int, input().split()))
h_t = []
w_t = []
s = []
for i1 in range(h):
h_t.append(0)
for i2 in range(w):
w_t.append(0)
for i in range(h):
s.append([])
for j in range(w):
s[i].append(0)
for i3 in range(m):
hi,wi = list(map(int, input().split()))
h_t[hi-1] += 1
w... | import sys
h,w,m = list(map(int, input().split()))
h_t = [0 for _ in range(h)]
w_t = [0 for _ in range(w)]
t = []
for _ in range(m):
hi,wi = list(map(int, input().split()))
h_t[hi-1] += 1
w_t[wi-1] += 1
t.append([hi-1,wi-1])
hmax = max(h_t)
wmax = max(w_t)
hmaxi = [i1 for i1 in range(h) if h_t[i1] =... | p02580 |
h,w,m=list(map(int,input().split()))
h_=[0]*(h+1)
w_=[0]*(w+1)
plot=set()
for _ in range(m):
x,y=list(map(int,input().split()))
h_[x]+=1
w_[y]+=1
plot.add((x,y))
x=max(h_)
y=max(w_)
a=[i for i,v in enumerate(h_) if v==x]
b=[j for j,q in enumerate(w_) if q==y]
u=0
c=0
for i in a:
for ... | h,w,m=list(map(int,input().split()))
h_=[0]*(h+1)
w_=[0]*(w+1)
plot=set()
for _ in range(m):
x,y=list(map(int,input().split()))
h_[x]+=1
w_[y]+=1
plot.add((x,y))
x=max(h_)
y=max(w_)
a=[i for i,v in enumerate(h_) if v==x]
b=[j for j,q in enumerate(w_) if q==y]
ans=x+y-1
c=False
for i in a:... | p02580 |
H,W,M=list(map(int,input().split()))
l = [ list(map(int,input().split(" "))) for i in range(M)]
h=[0]*H
w=[0]*W
for i in range(M):
h[l[i][0]-1]+=1
w[l[i][1]-1]+=1
maxh=max(h)
maxw=max(w)
hlist=[]
wlist=[]
for i in range(H):
if h[i]==maxh:
hlist.append(i)
for i in range(W):
if w[i]... | H,W,M=list(map(int,input().split()))
l = [ list(map(int,input().split(" "))) for i in range(M)]
h=[0]*H
w=[0]*W
for i in range(M):
h[l[i][0]-1]+=1
w[l[i][1]-1]+=1
maxh=max(h)
maxw=max(w)
hlist=[]
wlist=[]
for i in range(H):
if h[i]==maxh:
hlist.append(i)
for i in range(W):
if w[i]... | p02580 |
h,w,m=list(map(int,input().split()))
s=[]
t=[]
st=[[] for i in range(h+1)]
for i in range(m):
H,W=list(map(int,input().split()))
s.append(H)
t.append(W)
st[H].append(W)
from collections import Counter
u=Counter(s)
v=Counter(t)
max_u=max(u.values())
max_v=max(v.values())
import sys
for i in u:
... | h,w,m=list(map(int,input().split()))
s=[]
t=[]
for i in range(m):
H,W=list(map(int,input().split()))
s.append(H)
t.append(W)
from collections import Counter
u=Counter(s)
v=Counter(t)
max_u=max(u.values())
max_u_set = set([kv[0] for kv in list(u.items()) if kv[1]==max_u])
max_v=max(v.values())
m... | p02580 |
H, W, M = list(map(int, input().split()))
hw = []
h_cnt = [0] * H
w_cnt = [0] * W
hw = [tuple([int(x)-1 for x in input().split()]) for _ in range(M)]
for h, w in hw:
h_cnt[h] += 1
w_cnt[w] += 1
max_h = max(h_cnt)
max_w = max(w_cnt)
hs = [i for i in range(H) if h_cnt[i]==max_h]
ws = [i for i in ra... | H, W, M = list(map(int, input().split()))
h_cnt = [0] * H
w_cnt = [0] * W
hw = [tuple([int(x)-1 for x in input().split()]) for _ in range(M)]
for h, w in hw:
h_cnt[h] += 1
w_cnt[w] += 1
max_h = max(h_cnt)
max_w = max(w_cnt)
hs = [i for i in range(H) if h_cnt[i]==max_h]
ws = [i for i in range(W) if... | p02580 |
from collections import defaultdict
h, w, m = list(map(int, input().split()))
targets = defaultdict(int)
targets_count_yoko = defaultdict(int)
targets_count_tate = defaultdict(int)
for _ in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
targets_count_yoko[x] += 1
targets_co... | from collections import defaultdict
h, w, m = list(map(int, input().split()))
targets = defaultdict(int)
targets_count_yoko = defaultdict(int)
targets_count_tate = defaultdict(int)
for _ in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
targets_count_yoko[x] += 1
targets_co... | p02580 |
from collections import defaultdict
h, w, m = list(map(int, input().split()))
targets = []
targets_count_yoko = [0]*w
targets_count_tate = [0]*h
for _ in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
targets_count_yoko[x] += 1
targets_count_tate[y] += 1
targets.append... | from collections import defaultdict
h, w, m = list(map(int, input().split()))
targets = []
targets_count_w = defaultdict(int)
targets_count_h = defaultdict(int)
for _ in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
targets_count_w[x] += 1
targets_count_h[y] += 1
targ... | p02580 |
from collections import defaultdict
H, W, M = list(map(int, input().split()))
tate = defaultdict(int)
yoko = defaultdict(int)
T = {}
for i in range(M):
h, w = list(map(int, input().split()))
tate[h-1] += 1
yoko[w-1]+= 1
T[(h-1, w-1)] = 1
tate = sorted(list(tate.items()), key=lambda x:x[1], r... | from collections import defaultdict
H, W, M = list(map(int, input().split()))
tate = defaultdict(int)
yoko = defaultdict(int)
T = {}
for i in range(M):
h, w = list(map(int, input().split()))
tate[h-1] += 1
yoko[w-1]+= 1
T[(h-1, w-1)] = 1
tate = sorted(list(tate.items()), key=lambda x:x[1], r... | p02580 |
import sys
input = sys.stdin.readline
import heapq
from collections import Counter
H,W,M = list(map(int, input().split()))
BH = [[0,i] for i in range(H)]
BW = [[0,i] for i in range(W)]
Bomb = set()
for _ in range(M):
h,w = list(map(int, input().split()))
h,w = h-1,w-1
BH[h][0] += 1
BW[w][0] += 1
... | import sys
input = sys.stdin.readline
H,W,M = list(map(int, input().split()))
BH = [0 for i in range(H)]
BW = [0 for i in range(W)]
Bomb = set()
for _ in range(M):
h,w = list(map(int, input().split()))
h,w = h-1,w-1
BH[h] += 1
BW[w] += 1
Bomb.add((h,w))
BHMAX = max(BH)
BWMAX = max(BW)
HS =... | p02580 |
H, W, M = list(map(int, input().split()))
bom = [list(map(int, input().split())) for _ in range(M)]
hBom = [0]*H
wBom = [0]*W
# 各行、各列の爆破対象をカウント
for h, w in bom:
hBom[h-1] += 1
wBom[w-1] += 1
# 爆破対象の最大数と最大になる行と列の番号を調べる
maxHBom = max(hBom)
maxWBom = max(wBom)
maxHBomIndex = [index for index, h in... | H, W, M = list(map(int, input().split()))
boms = [tuple(map(int, input().split())) for _ in range(M)]
# boms = [list(map(int, input().split())) for _ in range(M)]
hBom = [0]*H
wBom = [0]*W
# 各行、各列の爆破対象をカウント
for h, w in boms:
hBom[h-1] += 1
wBom[w-1] += 1
# 爆破対象の最大数と最大になる行と列の番号を調べる
maxHBom = max(... | p02580 |
import sys
H,W,M=list(map(int, input().split()))
h=[]
w=[]
Hcount=[0 for _ in range(H)]
Wcount=[0 for _ in range(W)]
B=set()
for i in range(M):
hi,wi=list(map(int, input().split()))
h.append(hi)
w.append(wi)
B.add((hi,wi))
Hcount[hi-1]+=1
Wcount[wi-1]+=1
h_max=[i for i, v in enum... | import sys
input = sys.stdin.readline
def main():
H, W, M = list(map(int, input().split()))
row = [0] * (H)
col = [0] * (W)
bomb = set()
for _ in range(M):
h, w = list(map(int, input().split()))
bomb.add((h, w))
row[h-1] += 1
col[w-1] += 1
row... | p02580 |
import sys
H,W,M=list(map(int, input().split()))
h=[]
w=[]
Hcount=[0 for _ in range(H)]
Wcount=[0 for _ in range(W)]
B=set()
for i in range(M):
hi,wi=list(map(int, input().split()))
#h.append(hi)
#w.append(wi)
B.add((hi,wi))
Hcount[hi-1]+=1
Wcount[wi-1]+=1
h_max=[i for i, v in en... | import sys
H,W,M=list(map(int, input().split()))
h=[]
w=[]
Hcount=[0 for _ in range(H)]
Wcount=[0 for _ in range(W)]
B=set()
for i in range(M):
hi,wi=list(map(int, input().split()))
#h.append(hi)
#w.append(wi)
B.add((hi,wi))
Hcount[hi-1]+=1
Wcount[wi-1]+=1
Hcountmax=max(Hcount)
... | p02580 |
import sys
H,W,M=list(map(int, input().split()))
h=[]
w=[]
Hcount=[0 for _ in range(H)]
Wcount=[0 for _ in range(W)]
B=set()
for i in range(M):
hi,wi=list(map(int, input().split()))
#h.append(hi)
#w.append(wi)
B.add((hi,wi))
Hcount[hi-1]+=1
Wcount[wi-1]+=1
Hcountmax=max(Hcount)
... | import sys
H,W,M=list(map(int, input().split()))
h=[]
w=[]
Hcount=[0 for _ in range(H)]
Wcount=[0 for _ in range(W)]
B=set()
for i in range(M):
hi,wi=list(map(int, input().split()))
#h.append(hi)
#w.append(wi)
B.add((hi,wi))
Hcount[hi-1]+=1
Wcount[wi-1]+=1
Hcountmax=max(Hcount)
... | p02580 |
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
h, w, m = list(map(int, input().split()))
h_list = [0]*h
w_list = [0]*w
# h_w_list = [[0 for j in range(w)] for i in range(h)]
h_w_list = []
for zzz in range(m):
# print("---")
bom_h, bom_w = list(map(int, input().split()))
# print(bom_h, bom_w)
h_list[... | # -*- coding: utf-8 -*-
# スペース区切りの整数の入力
h, w, m = list(map(int, input().split()))
h_list = [0]*h
w_list = [0]*w
# h_w_list = [[0 for j in range(w)] for i in range(h)]
# h_w_list = []
h_w_list = set()
for zzz in range(m):
# print("---")
bom_h, bom_w = list(map(int, input().split()))
# print(bom_... | p02580 |
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = float('inf')
def L... | from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from copy import deepcopy
INF = float('inf')
def L... | p02580 |
import sys
input = sys.stdin.readline
r,c,m=list(map(int,input().split()))
q=[list([int(x)-1 for x in input().split()]) for _ in range(m)]
M=[[0 for i in range(c)] for _ in range(r)]
for i,j in q:
M[i][j]=1
rows = [0]*r
cols = [0]*c
for i in range(r):
rows[i]=sum(M[i])
for i in range(c):
... | import sys
input = sys.stdin.readline
r,c,m=list(map(int,input().split()))
q=set(tuple([int(x)-1 for x in input().split()]) for _ in range(m))
rows = [0]*r
cols = [0]*c
for i,j in q:
rows[i]+=1
cols[j]+=1
MAXR = max(rows)
MAXC = max(cols)
ans = MAXR+MAXC-1
rlist=[]
clist=[]
for i in ra... | p02580 |
from collections import defaultdict
def main():
height, width, target_count = [int(x) for x in input().split()]
count_by_height = defaultdict(int)
count_by_width = defaultdict(int)
bomb_is = set()
for _ in range(target_count):
bom_h, bom_w = [int(x) - 1 for x in input().split()]
... | from collections import defaultdict
def main():
height, width, target_count = [int(x) for x in input().split()]
count_by_height = defaultdict(int)
count_by_width = defaultdict(int)
bomb_locations = set()
for _ in range(target_count):
h, w = [int(x) - 1 for x in input().split()]
... | p02580 |
# -*- coding: utf-8 -*-
import sys
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H, W, M = list(map(int,readline().split()))
h_cnt = [0]*(H+1)
w_cnt = [0]*(W+1)
data = [[False]*(W+1) for i in range(H+1)]
for i in range(M):
h,... | # -*- coding: utf-8 -*-
import sys
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H, W, M = list(map(int,readline().split()))
h_cnt = [0]*(H+1)
w_cnt = [0]*(W+1)
bomb = []
for i in range(M):
h,w = list(map(int,readline().split... | p02580 |
h,w,m=list(map(int,input().split()))
lh=[0]*h
lw=[0]*w
l=[[0 for _ in range(w)] for _ in range(h)]
for i in range(m):
h1,w1=list(map(int,input().split()))
l[h1-1][w1-1]=1
lh[h1-1]+=1
lw[w1-1]+=1
hmax=max(lh)
wmax=max(lw)
lh2=[]
lw2=[]
for i in range(h):
if lh[i]==hmax:
lh2.append(i)
for i ... | h,w,m=list(map(int,input().split()))
lh=[0]*h
lw=[0]*w
l=set()
for i in range(m):
h1,w1=input().split()
l.add(h1+"_"+w1)
lh[int(h1)-1]+=1
lw[int(w1)-1]+=1
hmax=max(lh)
wmax=max(lw)
lh2=[]
lw2=[]
for i in range(h):
if lh[i]==hmax:
lh2.append(i)
for i in range(w):
if lw[i]==wmax:
f... | p02580 |
h, w, m = list(map(int, input().split()))
HW = [[*[int(x)-1 for x in input().split()]] for _ in range(m)]
sum_h = [[0,0] for _ in range(h)] # [sum, index]
sum_w = [[0,0] for _ in range(w)]
for i in range(m):
h,w = HW[i]
sum_h[h][0] += 1
sum_w[w][0] += 1
sum_h[h][1] = h
sum_w[w][1] = w
... | h, w, m = list(map(int, input().split()))
HW = [[*[int(x)-1 for x in input().split()]] for _ in range(m)]
sum_h = [[0,0] for _ in range(h)] # [sum, index]
sum_w = [[0,0] for _ in range(w)]
for i in range(m):
h,w = HW[i]
sum_h[h][0] += 1
sum_w[w][0] += 1
sum_h[h][1] = h
sum_w[w][1] = w
... | p02580 |
H, W, M = list(map(int, input().split()))
HW = set(tuple([int(x)-1 for x in input().split()]) for _ in range(M))
sum_h = [0]*H; sum_w = [0]*W
for h, w in HW:
sum_h[h] += 1
sum_w[w] += 1
max_h_num = 0
h_num_ix = {}
for i in range(H):
num = sum_h[i]
if num == 0: continue
if not num in h... | H, W, M = list(map(int, input().split()))
HW = set()
sum_h = [0]*H; sum_w = [0]*W
max_sum_h = max_sum_w = 0
for _ in range(M):
h, w = [int(x)-1 for x in input().split()]
HW.add((h, w))
sum_h[h] += 1
sum_w[w] += 1
max_sum_h = max(max_sum_h, sum_h[h])
max_sum_w = max(max_sum_w, sum_w[w... | p02580 |
import sys
import math
import fractions
from collections import defaultdict
import heapq
from bisect import bisect_left,bisect
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: list(map(int, stdin.readline().split()))
nl = lambda: list(... | import sys
import math
import fractions
from collections import defaultdict
import heapq
from bisect import bisect_left,bisect
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: list(map(int, stdin.readline().split()))
nl = lambda: list(... | p02580 |
h,w,m = list(map(int,input().split()))
row = [0]*(h+1)
col = [0]*(w+1)
bombs = set([])
for i in range(m):
a,b = list(map(int,input().split()))
row[a] += 1
col[b] += 1
bombs.add((a,b))
r,c = max(row),max(col)
for i in range(1,h+1):
if row[i]!=r:
continue
for j in range(1,w+1):
if col[j]... | h,w,m = list(map(int,input().split()))
row = [0]*(h+1)
col = [0]*(w+1)
bombs = set([])
for i in range(m):
a,b = list(map(int,input().split()))
row[a] += 1
col[b] += 1
bombs.add((a,b))
r,c = max(row),max(col)
rcnt,ccnt = 0,0
for v in row:
if v==r:
rcnt += 1
for v in col:
if v==c:
ccnt... | p02580 |
H, W, m = list(map(int, input().split()))
H_bomb = [0]*H
W_bomb = [0]*W
S = set()
for _ in range(m):
h, w = list(map(int, input().split()))
h, w = h-1, w-1
S.add(tuple([h, w]))
H_bomb[h] += 1
W_bomb[w] += 1
H_max = max(H_bomb)
W_max = max(W_bomb)
H_memo = []
W_memo = []
for i... | import sys
H, W, m = list(map(int, input().split()))
H_bomb = [0]*H
W_bomb = [0]*W
S = set()
for _ in range(m):
h, w = list(map(int, sys.stdin.readline().split()))
h, w = h-1, w-1
S.add(tuple([h, w]))
H_bomb[h] += 1
W_bomb[w] += 1
H_max = max(H_bomb)
W_max = max(W_bomb)
H_memo... | p02580 |
H, W, M = list(map(int, input().split()))
cnth = [[0, i] for i in range(H)]
cntw = [[0, i] for i in range(W)]
L = [[False for _ in range(W)] for _ in range(H)]
for _ in range(M):
h, w = [int(x) - 1 for x in input().split()]
cnth[h][0] += 1
cntw[w][0] += 1
L[h][w] = True
cnth.sort(reverse=True)
... | def main():
H, W, M = list(map(int, input().split()))
cnth = [[0, i] for i in range(H)]
cntw = [[0, i] for i in range(W)]
L = set()
for _ in range(M):
h, w = [int(x) - 1 for x in input().split()]
cnth[h][0] += 1
cntw[w][0] += 1
L.add((h, w))
cnth.sort(re... | p02580 |
h, w, m = list(map(int, input().split()))
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
mat = [[0 for _ in range(w)] for _ in range(h)]
for _ in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
h_cnt[y] += 1
w_cnt[x] += 1
mat[y][x] += 1
h_dict = {i:v for i,... | h, w, m = list(map(int, input().split()))
h_cnt = [0 for _ in range(h)]
w_cnt = [0 for _ in range(w)]
xs = []
ys = []
for _ in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
h_cnt[y] += 1
w_cnt[x] += 1
xs.append(x)
ys.append(y)
h_max = max(h_cnt)
w_max = max(w_c... | p02580 |
h,w,m=list(map(int,input().split()))
g=[0]*h
l=[0]*w
b=[]
for i in range(m):
x,y=list(map(int,input().split()))
g[x-1]+=1
l[y-1]+=1
b.append((x-1,y-1))
mxg=max(g);mxl=max(l)
mg=[i for i,x in enumerate(g) if x==mxg]
ml=[i for i,x in enumerate(l) if x==mxl]
c=0
for x,y in b:
if x in mg and y in ml... | h,w,m=list(map(int,input().split()))
g=[0]*h
l=[0]*w
b=[]
for i in range(m):
x,y=list(map(int,input().split()))
g[x-1]+=1
l[y-1]+=1
b.append((x-1,y-1))
mxg=max(g);mxl=max(l)
mg=set([i for i,x in enumerate(g) if x==mxg])
ml=set([i for i,x in enumerate(l) if x==mxl])
c=0
for x,y in b:
if x in mg a... | p02580 |
h,w,m = list(map(int,input().split()))
hw = [list(map(int,input().split())) for _ in range(m)]
hlist = [0]*(h+1)
wlist = [0]*(w+1)
for x,y in hw:
hlist[x]+=1
wlist[y]+=1
hmax=max(hlist)
h_index = [n for n, v in enumerate(hlist) if v == hmax]
wmax=max(wlist)
w_index = [n for n, v in enumerate(wlist)... | #実験 貼り付けコード
h,w,m = list(map(int,input().split()))
s = [list(map(int,input().split())) for _ in range(m)]
r = [0] * (h + 1)
c = [0] * (w + 1)
for x, y in s:
r[x] += 1
c[y] += 1
R = max(r)
nr = {i for i, x in enumerate(r) if x == R}
C = max(c)
nc = {i for i, x in enumerate(c) if x == C}
count = sum... | p02580 |
from collections import Counter
h, w, m = list(map(int, input().split()))
blist = [list(map(int, input().split())) for _ in range(m)]
rowdict = Counter([blist[i][0] for i in range(m)])
coldict = Counter([blist[i][1] for i in range(m)])
maxr = rowdict.most_common()[0][1]
maxr_keys = []
for i in rowdict.most_c... | from collections import Counter
h, w, m = list(map(int, input().split()))
blist = [list(map(int, input().split())) for _ in range(m)]
blist_set = set(map(tuple, blist))
rowdict = Counter([blist[i][0] for i in range(m)])
coldict = Counter([blist[i][1] for i in range(m)])
maxr = rowdict.most_common()[0][1]
m... | p02580 |
from collections import defaultdict
row=defaultdict(int)
col=defaultdict(int)
H,W,M=list(map(int,input().split()))
matrix=[[1 for i in range(W)] for j in range(H)]
for i in range(M):
h,w=list(map(int,input().split()))
row[h]+=1
col[w]+=1
matrix[h-1][w-1]=0
#print(row)
#print(col)
#for i in m... | from collections import defaultdict
row=defaultdict(int)
col=defaultdict(int)
H,W,M=list(map(int,input().split()))
#matrix=[[1 for i in range(W)] for j in range(H)]
matrix=defaultdict(bool)
for i in range(M):
h,w=list(map(int,input().split()))
row[h-1]+=1
col[w-1]+=1
matrix[(h-1,w-1)]=True
#p... | p02580 |
h,w,m=[int(i) for i in input().split()]
r=[0 for i in range(h)]
c=[0 for i in range(w)]
d={}
for i in range(m):
h1,w1=[int(i)-1 for i in input().split()]
r[h1]+=1
c[w1]+=1
x=str(h1)+"#"+str(w1)
d[x]=d.get(x,0)+1
maxx=0
for i in range(h):
for j in range(w):
x=str(i)+"#"+str... | h,w,m=[int(i) for i in input().split()]
r=[0 for i in range(h)]
c=[0 for i in range(w)]
d={}
for i in range(m):
h1,w1=[int(j)-1 for j in input().split()]
r[h1]+=1
c[w1]+=1
x=str(h1)+'#'+str(w1)
d[x]=d.get(x,0)+1
maxx=max(r)
r1=[]
for i in range(len(r)):
if maxx==r[i]:
r1.ap... | p02580 |
h, w, m = list(map(int, input().split()))
a = [[0 for _ in range(w)] for _ in range(h)]
for i in range(m):
hi, wi = list(map(int, input().split()))
a[hi-1][wi-1] = 1
mh = [sum(a[i][:]) for i in range(h)]
mw = [sum([r[i] for r in a]) for i in range(w)]
ans = max(mh) + max(mw)
mh = [i for i, v in enum... | h, w, m = list(map(int, input().split()))
a = [list([int(x) - 1 for x in input().split()]) for _ in range(m)]
mh = [0 for i in range(h)]
mw = [0 for j in range(w)]
for i, j in a:
mh[i] += 1
mw[j] += 1
hmax = max(mh)
wmax = max(mw)
ans = hmax + wmax
flag = mh.count(hmax) * mw.count(wmax)
for i,... | p02580 |
#!/usr/bin/env python3
import collections as cl
import sys
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return list(map(int, sys.stdin.readline().split()))
def main():
h, w, m = MI()
targets = [[] for i ... | #!/usr/bin/env python3
import collections as cl
import sys
def II():
return int(sys.stdin.readline())
def MI():
return list(map(int, sys.stdin.readline().split()))
def LI():
return list(map(int, sys.stdin.readline().split()))
def main():
h, w, m = MI()
targets = [[] for i ... | p02580 |
import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1)... | import sys
def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1)... | p02580 |
def resolve():
'''
code here
'''
H, W, M = [int(item) for item in input().split()]
targets = [[int(item) -1 for item in input().split()] for _ in range(M)]
col = [0 for _ in range(H)]
row = [0 for _ in range(W)]
bomb_set = set()
# 配列で要素を作ると要素数が$10^8$超える場合、setで要素の座標を持っておく... | def resolve():
'''
code here
'''
H, W, M = [int(item) for item in input().split()]
targets = [[int(item) -1 for item in input().split()] for _ in range(M)]
col = [0 for _ in range(H)]
row = [0 for _ in range(W)]
bomb_set = set()
# 配列で要素を作ると要素数が$10^8$超える場合、setで要素の座標を持っておく... | p02580 |
h, w, m = list(map(int, input().split()))
count_h = [0 for i in range(h)]
count_w = [0 for i in range(w)]
points = set()
for i in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
points.add((y, x))
count_h[y] += 1
count_w[x] += 1
ch_max, cw_max = max(count_h), max(co... | h, w, m = list(map(int, input().split()))
count_h = [0 for i in range(h)]
count_w = [0 for i in range(w)]
points = set()
for i in range(m):
y, x = list(map(int, input().split()))
y -= 1
x -= 1
points.add((y, x))
count_h[y] += 1
count_w[x] += 1
ch_max, cw_max = max(count_h), max(co... | p02580 |
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
readline = sys.stdin.buffer.readline
input = readline
mod = 10 ** 9 + 7
H, W, M = li... | import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
readline = sys.stdin.buffer.readline
input = readline
mod = 10 ** 9 + 7
H, W, M = li... | p02580 |
import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
readline = sys.stdin.buffer.readline
input = readline
mod = 10 ** 9 + 7
H, W, M = li... | import sys
import bisect
import itertools
import collections
import fractions
import heapq
import math
from operator import mul
from functools import reduce
from functools import lru_cache
def solve():
readline = sys.stdin.buffer.readline
input = readline
mod = 10 ** 9 + 7
H, W, M = li... | p02580 |
import sys
h, w, m = list(map(int, input().split()))
row = [0]*h
col = [0]*w
bomb = []
for x in sys.stdin.readlines():
H, W = list(map(int, x.split()))
bomb.append([H-1, W-1])
row[H-1] += 1
col[W-1] += 1
maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i ... | import sys
h, w, m = list(map(int, input().split()))
row = [0]*h
col = [0]*w
bomb = set()
for x in range(m):
H, W = list(map(int, input().split()))
bomb.add((H-1, W-1))
row[H-1] += 1
col[W-1] += 1
maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in rang... | p02580 |
import sys
h, w, m = list(map(int, input().split()))
row = [0]*h
col = [0]*w
bomb = []
for x in range(m):
H, W = list(map(int, input().split()))
bomb.append((H-1, W-1))
row[H-1] += 1
col[W-1] += 1
maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i in rang... | import sys
h, w, m = list(map(int, input().split()))
row = [0]*h
col = [0]*w
bomb = set()
for x in sys.stdin.readlines():
H, W = list(map(int, x.split()))
bomb.add((H-1, W-1))
row[H-1] += 1
col[W-1] += 1
maxrow = max(row)
maxcol = max(col)
ans = maxcol + maxrow - 1
p, q = [], []
for i ... | p02580 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.