Submission #1519520
Source Code Expand
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**20 gosa = 1.0 / 10**10 mod = 10**9 + 7 def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] def LS(): return sys.stdin.readline().split() def I(): return int(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) def S(): return input() def main(): w,h = LI() p = sorted([I() for _ in range(w)]) q = sorted([I() for _ in range(h)]) r = p[0] * (h+1) r += q[0] * (w+1) r -= max(p[0],q[0]) pi = 1 qi = 1 for i in range(w+h-2): if qi == h: r += p[pi] * (h-qi+1) pi += 1 elif pi == w: r += q[qi] * (w-pi+1) qi += 1 elif p[pi] < q[qi]: r += p[pi] * (h-qi+1) pi += 1 else: r += q[qi] * (w-pi+1) qi += 1 return r print(main())
Submission Info
Submission Time | |
---|---|
Task | C - Gr-idian MST |
User | iehn |
Language | Python (3.4.3) |
Score | 0 |
Code Size | 1135 Byte |
Status | WA |
Exec Time | 294 ms |
Memory | 14816 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | WA | 281 ms | 14816 KB |
02.txt | AC | 277 ms | 14440 KB |
03.txt | WA | 274 ms | 14524 KB |
04.txt | AC | 276 ms | 14516 KB |
05.txt | WA | 274 ms | 14444 KB |
06.txt | AC | 294 ms | 14508 KB |
07.txt | WA | 275 ms | 14516 KB |
08.txt | WA | 276 ms | 14512 KB |
09.txt | WA | 274 ms | 14440 KB |
10.txt | WA | 291 ms | 14448 KB |
11.txt | AC | 249 ms | 14528 KB |
12.txt | WA | 239 ms | 14060 KB |
13.txt | WA | 220 ms | 14144 KB |
14.txt | WA | 260 ms | 14444 KB |
15.txt | WA | 271 ms | 14444 KB |
16.txt | WA | 152 ms | 10692 KB |
17.txt | WA | 149 ms | 10700 KB |
18.txt | WA | 154 ms | 10704 KB |
19.txt | WA | 160 ms | 10632 KB |
20.txt | AC | 177 ms | 7708 KB |
21.txt | WA | 219 ms | 11292 KB |
22.txt | WA | 230 ms | 10928 KB |
23.txt | AC | 216 ms | 14124 KB |
24.txt | AC | 205 ms | 14088 KB |
25.txt | AC | 40 ms | 5348 KB |
26.txt | AC | 40 ms | 5340 KB |
27.txt | AC | 40 ms | 5340 KB |
28.txt | AC | 41 ms | 5340 KB |
s1.txt | AC | 40 ms | 5344 KB |
s2.txt | AC | 40 ms | 5468 KB |