98272024-03-08 21:18:10birozsDarabolás (50 pont)python3Accepted 50/50112ms44704 KiB
M,N = map(int,input().split())
sor = list(map(int,input().split()))
oszlop = list(map(int,input().split()))
rang_sor = [0] * 10001
rang_oszlop = [0] * 10001
for x in sor:
    rang_sor[x] += 1
for x in oszlop:
    rang_oszlop[x] += 1
v_vagas = 0
f_vagas = 0
koltseg = 0
for i in range(10000,0,-1):
    if rang_sor[i] > 0:
        koltseg += i * rang_sor[i] * (v_vagas+1)
        f_vagas += rang_sor[i]
        #print("V",i,koltseg)
    if rang_oszlop[i] > 0:
        koltseg += i * rang_oszlop[i] * (f_vagas+1)
        v_vagas += rang_oszlop[i]
        #print("F",i,koltseg)
print(koltseg)
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/019ms11544 KiB
2Accepted0/078ms33960 KiB
3Accepted1/121ms11916 KiB
4Accepted1/120ms12448 KiB
5Accepted1/120ms12364 KiB
6Accepted1/120ms12304 KiB
7Accepted1/119ms12340 KiB
8Accepted1/120ms12480 KiB
9Accepted1/120ms12756 KiB
10Accepted1/120ms12692 KiB
11Accepted1/120ms12924 KiB
12Accepted1/120ms13348 KiB
13Accepted1/120ms13272 KiB
14Accepted1/120ms13596 KiB
15Accepted1/121ms13868 KiB
16Accepted1/121ms13872 KiB
17Accepted1/121ms13860 KiB
18Accepted1/121ms14008 KiB
19Accepted2/221ms14020 KiB
20Accepted2/221ms14124 KiB
21Accepted3/328ms15428 KiB
22Accepted3/334ms17032 KiB
23Accepted4/450ms26452 KiB
24Accepted4/448ms25152 KiB
25Accepted4/472ms38620 KiB
26Accepted4/475ms36792 KiB
27Accepted4/4112ms44288 KiB
28Accepted4/4108ms44704 KiB