s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s665354300
p00730
u483082413
1591976841
Python
Python3
py
Accepted
80
5628
559
while True: n, w, h = map(int, input().split()) if w == 0: break ls = [[w, h]] for i in range(n): p, s = map(int, input().split()) p -= 1 pw, ph = ls[p] if s % (pw + ph) < pw: s %= pw + ph ls.extend([[min(s, pw - s), ph], [max(s, pw - s), p...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,496
s018542381
p00730
u781213648
1591952137
Python
Python3
py
Accepted
100
5644
1,595
def cake(n, w, d): piece = [0] * (n + 1) piece[0] = [w, d, w * d] ps = [0] * n for i in range(n):#100 #print(piece) p, s = map(int, input().split()) now = piece[p - 1]#切るケーキ nw, nd = now[0], now[1] s = s % (nw + nd) if p != i + 1: for j in range(p, i + 2): piece[j - 1] = pi...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,497
s627785635
p00730
u610816226
1591877179
Python
Python3
py
Accepted
70
5644
833
import sys def input(): return sys.stdin.readline().strip() def mapint(): return map(int, input().split()) sys.setrecursionlimit(10**9) while 1: N, W, D = mapint() if N==0 and W==0 and D==0: break cakes = [(W, D)] for i in range(N): p, s = mapint() w, h = cakes.pop(p-1) s...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,498
s260102753
p00730
u928664635
1591855297
Python
Python3
py
Accepted
90
5628
742
while(1): n, w, h = map(int, input().split()) if not n+w+h: break t = [[w, h]] for i in range(n): p, s = map(int, input().split()) cur = t.pop(p-1) W = cur[0] H = cur[1] s %= 2*W+2*H if s < W: a = min(s, W-s) t.extend([[a, H...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,499
s600887867
p00730
u512884261
1589776697
Python
Python3
py
Accepted
70
6260
1,773
import sys input = lambda: sys.stdin.readline().rstrip() sys.setrecursionlimit(10**7) INF = 10**10 def I(): return int(input()) def F(): return float(input()) def S(): return input() def LI(): return [int(x) for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] def LF(): return [float(x) for ...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,500
s348883655
p00730
u647694976
1589774072
Python
Python3
py
Accepted
80
5624
508
while True: n,w,h = map(int,input().split()) if w == 0: break ls = [[w,h]] for i in range(n): p,s = map(int,input().split()) p -= 1 pw,ph = ls[p] if s%(pw+ph) < pw: s %= pw+ph ls.extend([[min(s,pw-s),ph],[max(s,pw-s),ph]]) else: ...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,501
s906243948
p00730
u069607647
1589647009
Python
Python3
py
Accepted
80
6292
1,646
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1149&lang=jpfrom bisect import bisect_left # 対称性から s <= w + h の範囲のみを考えれば良い import sys read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines class Cake: def __init__(self, h, w): self.height = h self.width = w ...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,502
s491856627
p00730
u480920780
1586187954
Python
Python3
py
Accepted
100
6028
525
import sys def input(): return sys.stdin.buffer.readline()[:-1] while True: n, w, d = map(int, input().split()) if n == w == d == 0: break cakes = dict() cakes[1] = [w, d] for i in range(1, n+1): p, s = map(int, input().split()) w, d = cakes[p] for j in range(p, i): cakes[j] = cakes[j+1] s %= w+d ...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,503
s908920446
p00730
u781622789
1586077445
Python
Python3
py
Accepted
80
5624
509
while True: n,w,h = map(int,input().split()) if w == 0: break ls = [[w,h]] for i in range(n): p,s = map(int,input().split()) p -= 1 pw,ph = ls[p] if s%(pw+ph) < pw: s %= pw+ph ls.extend([[min(s,pw-s),ph],[max(s,pw-s),ph]]) else: ...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,504
s771748021
p00730
u853158149
1584966925
Python
Python3
py
Accepted
80
6508
1,675
#!usr/bin/env python3 from collections import defaultdict,deque from heapq import heappush, heappop from itertools import permutations import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def LS():return [list(x) for x in sys.stdi...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,505
s496912590
p00730
u037175009
1584366627
Python
Python3
py
Accepted
90
7096
974
import sys,queue,math,copy sys.setrecursionlimit(10**7) input = sys.stdin.readline LI = lambda : [int(x) for x in input().split()] _LI = lambda : [int(x)-1 for x in input().split()] while True: N,W,D = LI() if N==0 and W==0 and D==0: break q = [(W*D,W,D)] for _ in range(N): p,s = LI() ...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,506
s376875892
p00730
u215870135
1562683648
Python
Python3
py
Accepted
80
6668
1,076
import sys input = sys.stdin.readline def main(): while True: n, w, d = map(int, input().split()) if w == 0: break cuts = [list(map(int, input().split())) for i in range(n)] cakes = [(w,d,w*d)] for cut in cuts: p, s = cut w, d, wd = cakes....
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,507
s082448561
p00730
u886122084
1560922613
Python
Python3
py
Accepted
60
5648
983
# -*- coding: utf-8 -*- # python template for atcoder1 import sys sys.setrecursionlimit(10**9) input = sys.stdin.readline def solve(): N, W, D = map(int, input().split()) if N == 0 and W == 0 and D == 0: exit() L = [] L.append((W, D)) for _ in range(N): op, le = map(int, input().s...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,508
s681883690
p00730
u799595944
1551704207
Python
Python3
py
Accepted
100
5616
1,989
def cut2(cut_place, width, height): part1 = [width, cut_place] part2 = [width, height - cut_place] if height - cut_place >= cut_place: output = [part1, part2] else: output = [part2, part1] return output def cut1(cut_place, width, height): part1 = [cut_place, height] part2 = ...
p00730
<h1><font color="#000">Problem C:</font> Cut the Cake</h1> <!-- end en only --> <p> Today is the birthday of Mr. Bon Vivant, who is known as one of the greatest <i>p&acirc;tissiers</i> in the world. Those who are invited to his birthday party are <i>gourmets</i> from around the world. They are eager to see and eat h...
3 5 6 1 18 2 19 1 2 3 4 1 1 1 2 1 3 1 0 2 5 0 0 0
4 4 6 16 1 1 1 1 10
24,509
s680132755
p00733
u260980560
1595602362
Python
Python3
py
Accepted
80
6304
1,685
import sys readline = sys.stdin.readline write = sys.stdout.write def parse(S): S = S + "$" cur = 0 mp = {"01": 0} sp = {"01": {0}} sv = {"01": (0, 1)} lbl = 1 fmt = "0{}{}1".format def comp(left, right): lcs, lb = left rcs, rb = right a0, b0 = sv[lb] a1, ...
p00733
<h1><font color="#000000">Problem F: </font>Dr. Podboq or: How We Became Asymmetric</h1> <p> After long studying how embryos of organisms become asymmetric during their development, Dr. Podboq, a famous biologist, has reached his new hypothesis. Dr. Podboq is now preparing a poster for the coming academic conferenc...
(((x x) x) ((x x) (x (x x)))) (((x x) (x x)) ((x x) ((x x) (x x)))) (((x x) ((x x) x)) (((x (x x)) x) (x x))) (((x x) x) ((x x) (((((x x) x) x) x) x))) (((x x) x) ((x (x x)) (x (x x)))) ((((x (x x)) x) (x ((x x) x))) ((x (x x)) (x x))) ((((x x) x) ((x x) (x (x x)))) (((x x) (x x)) ((x x) ((x x) (x x))))) 0
((x (x x)) ((x x) ((x x) x))) (((x x) ((x x) (x x))) ((x x) (x x))) (((x ((x x) x)) (x x)) ((x x) ((x x) x))) (((x ((x ((x x) x)) x)) (x x)) ((x x) x)) ((x (x x)) ((x (x x)) ((x x) x))) (((x (x x)) (x x)) ((x ((x x) x)) ((x (x x)) x))) (((x (x x)) ((x x) ((x x) x))) (((x x) (x x)) (((x x) (x x)) (x x))))
24,510
s427435114
p00734
u731941832
1530803659
Python
Python3
py
Accepted
30
5600
371
while True: n,m=map(int,input().split()) if n==0:break a=[int(input())for _ in range(n)] b=[int(input())for _ in range(m)] sa=sum(a) sb=sum(b) f=0 for i in a: for j in b: if sa-i+j==sb-j+i: print(i,j) f=1 break i...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,511
s821136871
p00734
u847467233
1531659257
Python
Python3
py
Accepted
40
5604
430
# AOJ 1153: Equal Total Scores # Python3 2018.7.15 bal4u INF = 0x7fffff while True: n, m = map(int, input().split()) if n == 0: break a = [int(input()) for i in range(n)] b = [int(input()) for i in range(m)] sa = sum(a) - sum(b) ss = INF for i in range(n): for j in range(m): if ((a[i]-b[j])<<1) == sa: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,512
s711069257
p00734
u046108504
1555786272
Python
Python3
py
Accepted
100
5724
722
while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [int(input()) for _ in range(n)] hanako = [int(input()) for _ in range(m)] trade_n = [] trade_m = [] for t in taro: for h in hanako: if (sum(taro) - t + h) == (sum(hanako) - h + t): ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,513
s532502328
p00734
u328199937
1555815814
Python
Python3
py
Accepted
50
5600
656
anslist = [] while True: ans = 0 n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [] hanako = [] for i in range(n): s = int(input()) taro.append(s) for i in range(m): s = int(input()) hanako.append(s) ans = -1 for i in range...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,514
s397945632
p00734
u164311692
1558925120
Python
Python3
py
Accepted
40
5608
557
def answer(n, m, taro, hanako): for t in sorted(taro): for h in sorted(hanako): if sum(taro) - t + h == sum(hanako) - h + t: return f'{t} {h}' return -1 while True: n, m = map(int, input().split()) # 組み込み関数input()は標準入力から読み込まれた1行を返す. if n == 0 and m == 0: bre...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,515
s174457449
p00734
u191474223
1559135924
Python
Python3
py
Accepted
50
7456
771
from collections import defaultdict,deque import sys,heapq,bisect,math,itertools,string,queue,datetime sys.setrecursionlimit(10**8) INF = float('inf') mod = 10**9+7 eps = 10**-7 def inp(): return int(sys.stdin.readline()) def inpl(): return list(map(int, sys.stdin.readline().split())) def inpl_str(): return list(sys.st...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,516
s634429797
p00734
u788553535
1559137853
Python
Python3
py
Accepted
30
5600
419
while True: n,m = map(int,input().split()) if n + m == 0: break Taro = [int(input()) for _ in range(n)] Hana = [int(input()) for _ in range(m)] st = sum(Taro) sh = sum(Hana) for t in range(n): for h in range(m): if st - 2*Taro[t] == sh - 2*Hana[h]: print(Taro[t],Hana[h]) st =...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,517
s120112848
p00734
u966364923
1419350202
Python
Python3
py
Accepted
30
6724
562
while True: (n, m) = [int(x) for x in input().split()] if n==0 and m==0: exit() a = [] b = [] for i in range(n): a.append(int(input())) for i in range(m): b.append(int(input())) a_sum = sum(a) b_sum = sum(b) target = a_sum - b_sum found = False for ai ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,518
s327650452
p00734
u617183767
1420194073
Python
Python
py
Accepted
30
5388
1,281
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import itertools import math from collections import Counter, defaultdict class Main(object): def __init__(self): pass def solve(self): ''' insert your code ''' while True: n, m = map(...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,519
s865133609
p00734
u766477342
1420497431
Python
Python3
py
Accepted
40
6720
460
while 1: n, m = list(map(int, input().split())) if n == 0:break n_v = [int(input()) for i in range(n)] m_v = [int(input()) for i in range(m)] n_s = sum(n_v) m_s = sum(m_v) swap_min = 99999999 x = n_s - m_s res = '-1' for nv in n_v: for mv in m_v: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,520
s311860544
p00734
u316268279
1420528834
Python
Python3
py
Accepted
30
6720
541
#!/usr/bin/env python # -*- coding: utf-8 -*- while True: n,m = map(int,input().split()) if n == 0 and m == 0: break taro = [int(input()) for i in range(0,n)] hanako = [int(input()) for i in range(0,m)] taro_hand = sum(taro) hanako_hand = sum(hanako) ans = -1 for i in sorted(tar...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,521
s564729317
p00734
u731235119
1421835644
Python
Python
py
Accepted
30
4232
424
while 1: n, m = map(int, raw_input().split(" ")) if (n,m) == (0,0): break tarou = [int(raw_input()) for i in range(n)] t_total = sum(tarou) hanako = [int(raw_input()) for i in range(m)] h_total = sum(hanako) pair = (101,101) for t in tarou : for h in hanako: if t_total - t + h == h_total - h + t: if ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,522
s267924680
p00734
u120360464
1421837180
Python
Python
py
Accepted
40
4252
514
#! /usr/bin/python # -*- coding: utf-8 -*- (n, m) = map(int, raw_input().split()) while n!=0 or m!=0: T = [int(raw_input()) for i in range(n)] H = [int(raw_input()) for i in range(m)] min = [1000, 1000] for i in range(n): for j in range(m): if(sum(T)-T[i]+H[j] == sum(H)+T[i]-H[j] an...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,523
s082937939
p00734
u124909914
1425268855
Python
Python3
py
Accepted
50
6724
1,240
#!/usr/bin/python3 while True: n, m = list(map(int, input().split())) if n == 0 and m == 0: break taro = [] hanako = [] for i in range(n): taro.append(int(input())) for i in range(m): hanako.append(int(input())) sum_taro = sum(taro) sum_hana = sum(hanako) dif = sum_...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,524
s471895326
p00734
u128811851
1434525617
Python
Python3
py
Accepted
80
7272
1,550
def impossible(taro_cards, hanako_cards, average): if (sum(taro_cards) + sum(hanako_cards)) % 2 == 1: return True elif sum(taro_cards) + max(taro_cards) - min(hanako_cards) < average: return True elif sum(hanako_cards) + max(hanako_cards) - min(taro_cards) < average: return True ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,525
s805634373
p00734
u998188826
1441284709
Python
Python3
py
Accepted
40
7676
465
while True: n, m = map(int, input().split()) if (n, m) == (0, 0): break res = None taro = [int(input()) for i in range(n)] hana = [int(input()) for i in range(m)] taros = sum(taro) hanas = sum(hana) diff = (hanas-taros) for i in range(n): for j in range(m): if diff == ((hana[j] - taro[i])*2): if r...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,526
s832644414
p00734
u222964743
1451891673
Python
Python
py
Accepted
20
6372
611
while True: n,m = raw_input().split(" ") n = int(n) m = int(m) if n*m==0: break a_all = 0 b_all = 0 A = [] B = [] for i in xrange(0,n): x = input() x = int(x) A.append(x) a_all += x for j in xrange(0,m): y = input() y = int(y) B.append(y) b_all += y A.sort() B.sort() sa = abs(a_all - b_al...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,527
s154224411
p00734
u488601719
1452321323
Python
Python
py
Accepted
30
6260
518
while True: n, m = map(int, raw_input().split()) if n == 0: break taro = [int(raw_input()) for i in range(n)] taro_sum = sum(taro) hanako = [int(raw_input()) for j in range(m)] hanako_sum = sum(hanako) pair = (101, 101) for t in taro: for h in hanako: if t...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,528
s488827718
p00734
u766163292
1454925855
Python
Python3
py
Accepted
50
9404
822
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array import heapq import itertools def solve(taro_cards, hanako_cards): sum_taro = sum(taro_cards) sum_hanako = sum(hanako_cards) candidates = [] for t, h in itertools.product(taro_cards, hanako_cards): if sum_taro - t + h == sum_hanako -...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,529
s926810576
p00734
u336892997
1461485197
Python
Python3
py
Accepted
30
7792
778
def solve1(): N, M = [int(s) for s in input().split()] if N == M == 0: return False taro = [int(input()) for _ in range(N)] taro.sort() hana = [int(input()) for _ in range(M)] hana.sort() diff = sum(taro) - sum(hana) ans = compare(diff, taro, hana); if ans is None: pr...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,530
s650377936
p00734
u358919705
1475491857
Python
Python3
py
Accepted
40
7680
505
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1153&lang=jp "Equal Total Scores" ????§£?????? while True: n, m = map(int, input().split()) if not n: break taro = [int(input()) for i in range(n)] hanako = [int(input()) for i in range(m)] dif = sum(taro) - sum(hanako) ans = [-...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,531
s339089346
p00734
u166860661
1480835308
Python
Python
py
Accepted
10
6400
947
# coding: utf-8 # Here your code ! while True: l = map(int,raw_input().split()) if l == [0,0]: break else: check = 0 taro = 0 l1 = [] for i in range(l[0]): n = int(raw_input()) l1.append(n) l1.sort() l2 = [] for i in ran...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,532
s652889419
p00734
u922871577
1481100157
Python
Python
py
Accepted
20
6284
472
while True: N, M = map(int, raw_input().split()) if N == M == 0: break A = [int(raw_input()) for _ in xrange(N)] B = [int(raw_input()) for _ in xrange(M)] s = sum(A) - sum(B) A = set(A) B = set(B) if s % 2 != 0: print -1 continue ans = [] for a in A: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,533
s175841492
p00734
u660912567
1481394418
Python
Python3
py
Accepted
30
7488
376
def search(t,st,h,sh): for ta in t: for ha in h: if st-ta+ha==sh-ha+ta: return ' '.join(map(str,[ta,ha])) return -1 while True: n,m = map(int,input().split()) if n==m==0: break t = sorted([int(input()) for _ in range(n)]) h = sorted([int(input()) for _ in range(m)]) st,s...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,534
s872377372
p00734
u128892650
1482831229
Python
Python3
py
Accepted
30
7612
433
# coding: utf-8 def ans(t,h,t_s,h_s): for i in t: for j in h: if t_s - i + j == h_s - j + i: return str(i) + " " + str(j) return -1 while True: n, m = [int(x) for x in input().split()] # print(n,m) if n == 0 and m == 0: break t = [int(input()) for i in...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,535
s492416775
p00734
u633333374
1485681070
Python
Python
py
Accepted
90
7456
784
while 1: n,m = map(int,raw_input().split()) if n == 0 and m == 0: break t = [] h = [] pair = [] score = [] lst = [] for i in range(n): t.append(int(raw_input())) for i in range(m): h.append(int(raw_input())) for i in range(n): for j in range(m...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,536
s714775608
p00734
u661290476
1487388080
Python
Python3
py
Accepted
80
7688
920
while True: n, m = map(int, input().split()) if n == m == 0: break taro = [int(input()) for i in range(n)] hanako = [int(input()) for i in range(m)] #??????????????¨????¨?????\???°???????????? if (sum(taro) + sum(hanako)) % 2 == 1: print(-1) continue half = (sum(taro...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,537
s420476194
p00734
u923668099
1489767230
Python
Python3
py
Accepted
40
7644
706
from sys import stdin, stdout, stderr while 1: n, m = map(int, stdin.readline().split()) if n + m == 0: break taro = [int(stdin.readline()) for i in range(n)] hana = [int(stdin.readline()) for i in range(m)] tsum = sum(taro) hsum = sum(hana) if (tsum - hsum) % 2: print(-...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,538
s581554818
p00734
u807440918
1493357676
Python
Python3
py
Accepted
50
7692
422
while 1: n, m = map(int, input().split()) if not n: break t_card = [int(input()) for i in range(n)] h_card = [int(input()) for i in range(m)] total = [-1] dif = sum(t_card) - sum(h_card) for i in t_card: for j in h_card: if (i - j) * 2 == dif: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,539
s174089570
p00734
u506554532
1512921209
Python
Python3
py
Accepted
30
5604
405
while True: n,m = map(int,input().split()) if n == m == 0: break c1 = [int(input()) for i in range(n)] c2 = [int(input()) for i in range(m)] diff = sum(c1) - sum(c2) if diff % 2 == 1: print(-1) continue for v1 in sorted(c1): v2 = v1 - diff//2 if v2 in c2: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,540
s317665506
p00734
u672443148
1514710448
Python
Python3
py
Accepted
40
5612
705
while True: N,M=map(int,input().split()) if N==0 and M==0: break allCards=[] for i in range(N+M): allCards.append(int(input())) Taro=allCards[:N] Hanako=allCards[N:] Tsum=sum(Taro) Hsum=sum(Hanako) diff=Tsum-Hsum tempsum=1e8 Tchange=-1...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,541
s094405807
p00734
u306037418
1518241785
Python
Python3
py
Accepted
50
5596
573
while True: n, m = map(int, input().split()) if n == m == 0: quit() s1, s2 = [], [] for i in range(n): s1.append(int(input())) for i in range(m): s2.append(int(input())) s1.sort() s2.sort(reverse=True) sum1 = sum(s1) sum2 = sum(s2) temp = 101 for i in ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,542
s666865654
p00734
u146816547
1523965895
Python
Python
py
Accepted
10
4656
528
while True: n, m = map(int, raw_input().split()) if n == 0 and m == 0: break taro = sorted([int(raw_input()) for _ in range(n)]) hanako = sorted([int(raw_input()) for _ in range(m)]) diff = sum(taro) - sum(hanako) flag = False def fnc(): global flag for i in taro...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,543
s277756604
p00734
u023471147
1526571522
Python
Python3
py
Accepted
20
5608
679
while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [int(input()) for i in range(n)] hanako = [int(input()) for i in range(m)] taro.sort() hanako.sort() diff = sum(taro) - sum(hanako) if diff % 2 != 0: print(-1) continue diff /...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,544
s525451271
p00734
u509278866
1527823344
Python
Python3
py
Accepted
60
9032
1,085
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools sys.setrecursionlimit(10**7) inf = 10**3 eps = 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():...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,545
s511263669
p00734
u136916346
1529978424
Python
Python3
py
Accepted
30
5612
484
while 1: n,m = list(map(int,input().split())) if not n and not m:break ln=sorted([int(input()) for _ in range(n)]) lm=sorted([int(input()) for _ in range(m)]) cd_n=set(ln) cd_m=set(lm) g=(sum(lm)-sum(ln)) f=False if g%2==1:f=True else:g=g/2 bf=False for i in cd_m: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,546
s199011804
p00734
u064170672
1530185437
Python
Python3
py
Accepted
40
5608
645
while(True): n, m = map(int, input().split()) st = [] sh = [] if(n==0): break for i in range(n): st.append(int(input())) for i in range(m): sh.append(int(input())) # st.sort() # sh.sort() ans = [100000, 100000] if (sum(st)-sum(sh))%2 == 1: pri...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,547
s588151514
p00734
u352394527
1530354195
Python
Python3
py
Accepted
30
5600
379
while True: n, m = map(int, input().split()) if n == 0: break alst = [int(input()) for _ in range(n)] blst = [int(input()) for _ in range(m)] alst.sort() blst.sort() suma = sum(alst) sumb = sum(blst) def search(): for a in alst: for b in blst: if (a - b) * 2 == suma - sumb: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,548
s949372865
p00734
u109084363
1358009178
Python
Python
py
Accepted
20
4280
747
import sys while True: n, m = map(int, sys.stdin.readline().split()) if n == 0 and m ==0: break taro = [] for i in xrange(n): x = int(sys.stdin.readline()) taro.append(x) hanako = [] for i in xrange(m): x = int(sys.stdin.readline()) ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,549
s770653981
p00734
u104911888
1368580713
Python
Python
py
Accepted
30
5016
491
while True: n,m=map(int,raw_input().split()) if n==m==0:break taro=[input() for i in range(n)] hana=[input() for i in range(m)] L=[] sumta=sum(taro) sumha=sum(hana) for i in range(n): temp1=sumta-taro[i] temp2=sumha+taro[i] for j in range(m): if temp1+...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,550
s819879191
p00734
u633068244
1399452365
Python
Python
py
Accepted
20
4240
310
while 1: n,m = map(int,raw_input().split()) if n == 0: break taro = sorted([int(raw_input()) for i in range(n)]) hana = [int(raw_input()) for i in range(m)] d = sum(hana) - sum(taro) t,h = 101,101 for i in taro: if d/2.0 + i in hana: t,h = i,d/2 + i break print "%d %d"%(t,h) if t < 101 else -1
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,551
s514202032
p00734
u470391435
1597755570
Python
Python3
py
Accepted
40
5600
513
while True: n, m = map(int,input().split()) if n==0 and m==0: break a = [int(input()) for i in range(n)] b = [int(input()) for i in range(m)] a.sort() b.sort() c=0 d=0 for i in range(len(a)): if d==1: break for j in range(len(b)): if su...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,552
s357116868
p00734
u371026526
1597737110
Python
Python3
py
Accepted
30
5600
382
while True: n,m = map(int,input().split()) if n==0 and m==0: break taro = [int(input()) for i in range(n)] hanako = [int(input()) for i in range(m)] d = sum(taro)-sum(hanako) def search(): for i in taro: for j in hanako: if (i-j)*2 == d: print...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,553
s248296780
p00734
u555228137
1597731324
Python
Python3
py
Accepted
30
5608
644
while True: n,m=map(int,input().split()) if n==m==0: break ta=[int(input()) for i in range(n)] ha=[int(input()) for i in range(m)] taro=sorted(ta) hana=sorted(ha) taha=(sum(ta)-sum(ha))/2 kai=0 if taha<0: for i in range(len(taro)): if taro[i]+abs(taha) in ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,554
s254503297
p00734
u988962397
1597684654
Python
Python3
py
Accepted
40
5600
560
while True: n,m=map(int, input().split()) if(n==0): break cn=[] cm=[] for i in range(n): cn.append(int(input())) for i in range(m): cm.append(int(input())) k=0 for i in range(n): for j in range(m): cn[i],cm[j]=cm[j],cn[i] if(s...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,555
s332392439
p00734
u593595530
1597670514
Python
Python3
py
Accepted
100
6508
514
while True: n,m = map(int,input().split()) if n == 0: exit() t = [] h = [] num = [] for i in range(n): t.append(int(input())) for i in range(m): h.append(int(input())) for i in range(n): for j in range(m): if (sum(t) - t[i] + h[j]) == (sum(h) -...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,556
s695305784
p00734
u695568874
1597505812
Python
Python3
py
Accepted
50
5600
521
while True: m,n=map(int,input().split()) if m==0 and n==0: break A=[] B=[] S=0 T=0 V=0 for i in range(m): a=int(input()) A.append(a) S=S+a for i in range(n): b=int(input()) B.append(b) T=T+b for j in range(m): for k ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,557
s150359718
p00734
u799752967
1597458281
Python
Python3
py
Accepted
30
5600
398
while True: n,m=map(int,input().split()) if n==0: break a=[int(input()) for _ in range(n)] b=[int(input()) for _ in range(m)] a.sort() b.sort() sumA=sum(a) sumB=sum(b) def search(): for i in a: for j in b: if (i-j)*2==sumA-sumB: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,558
s283387924
p00734
u884758681
1597334610
Python
Python3
py
Accepted
30
5608
679
while True: n, m = map(int, input().split()) if n == 0 and m == 0: break taro = [int(input()) for i in range(n)] hanako = [int(input()) for i in range(m)] taro.sort() hanako.sort() diff = sum(taro) - sum(hanako) if diff % 2 != 0: print(-1) continue diff /...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,559
s590921382
p00734
u053015104
1597258263
Python
Python3
py
Accepted
40
5600
1,142
#入力はn, mの2行 #0 0が入力の終わりなのでwhile Trueのif #for(1, n)は太郎、for(n+1, n+m)は花子、sum+=でそれぞれ合計を出す #交換するとき(差/2)を小さい方から出したxに足すと大きい方から出す数に等しい #ソートして同じi番目で差がsa/2だったら答え #見つからんのやったらprint(-1) while True: n, m = map(int, input().split()) if n == 0 and m == 0: break else: taro = [] hana = [] ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,560
s950572795
p00734
u711365732
1596761928
Python
Python3
py
Accepted
50
5608
1,082
while True: n,m = map(int, input().split()) if n == 0 and m == 0: break T = [] H = [] for i in range(n): t = int(input()) T.append(t) for j in range(m): h = int(input()) H.append(h) T.sort() H.sort() min = [] if (sum(T) - sum(H))%2!=0 or (sum(H) - s...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,561
s024914990
p00734
u826807985
1595826708
Python
Python3
py
Accepted
30
5608
916
while True: n,m = map(int,input().split()) if n==0 and m==0: break lt=[] lh= [] for i in range(n): sn=int(input()) lt.append(sn) for j in range(m): sm=int(input()) lh.append(sm) s = (sum(lt)+sum(lh))/2 st= abs(s-sum(lt)) lt.sort() lh.sort...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,562
s508589725
p00734
u836923362
1595603375
Python
Python3
py
Accepted
90
5608
918
#23:52 while True: taro_cards,hanako_cards = map(int,input().split()) if taro_cards==0 and hanako_cards==0: break taros_card = [int(input()) for _ in range(taro_cards)] hanakos_card = [int(input()) for _ in range(hanako_cards)] diff = sum(taros_card) - sum(hanakos_card) taros_card.sort...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,563
s186043359
p00734
u037263780
1595428283
Python
Python3
py
Accepted
50
5604
522
while True: n,m=map(int,input().split()) if n==0 and m==0: break st=[int(input()) for t in range(n)] sh=[int(input()) for h in range(m)] st.sort() sh.sort() x=0 y=0 for i in range(len(st)): if y==1: break for j in range(len(sh)): if sum...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,564
s514368429
p00734
u128671689
1595246883
Python
Python3
py
Accepted
30
5604
374
def f(): for i in t: for j in h: if (i-j)*2==sumt-sumh: print(i,j) return print(-1) while True: n,m=map(int,input().split()) if n==0: break t=[int(input()) for i in range(n)] h=[int(input()) for j in range(m)] t.sort()...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,565
s493756215
p00734
u290304811
1595224415
Python
Python3
py
Accepted
90
5720
445
while True: n,m = map(int,input().split()) if n==m==0: break taro = [int(input()) for i in range(n)] hanako = [int(input()) for i in range(m)] ans1 = []; ans2 = [] for i in sorted(taro): for j in sorted(hanako): if sum(taro)-i+j == sum(hanako)-j+i: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,566
s209589232
p00734
u395654950
1594620897
Python
Python3
py
Accepted
40
5616
1,378
# coding: utf-8 # Your code here! while True: n, m = map(int, input().split()) if n + m == 0: break sums = 0 #太郎のカードの和 TARO = [] for i in range(n): taro = int(input()) TARO.append(taro) sums += taro sumh = 0 #花子のカードの HANAKO = [] for i in range(m): hanako = in...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,567
s392641645
p00734
u253463111
1594607235
Python
Python3
py
Accepted
90
5604
405
while True: n,m=map(int,input().split()) if n==0 and m==0: break a=[int(input()) for i in range(n)] b=[int(input()) for i in range(m)] ans=[-1] va=100000 for i in range(n): for j in range(m): if sum(a)-a[i]+b[j]==sum(b)-b[j]+a[i]: if (a[i]+b[j])<va...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,568
s074219231
p00734
u060839454
1594480790
Python
Python3
py
Accepted
30
5712
838
import sys import math import itertools input = sys.stdin.readline ## while True: n, m = input().rstrip().split() n, m = int(n), int(m) if n + m == 0: sys.exit() taro = [] hanako = [] for _ in range(n): taro.append(int(input().rstrip())) for _ in range(m): hanak...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,569
s411314800
p00734
u994684803
1592832789
Python
Python3
py
Accepted
90
5712
580
while True: m,n = map(int,input().split()) if m== 0 and n == 0: break ta=[] ha=[] for i in range(m): ta.append(int(input())) for i in range(n): ha.append(int(input())) ta=sorted(ta) ha=sorted(ha) ans1=[] ans2=[] for i in sorted...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,570
s155686036
p00734
u489396453
1592585534
Python
Python3
py
Accepted
30
5608
977
while True: data = input().split() n,m = int(data[0]),int(data[1]) if n == 0 and m == 0: break tarou_cards = [] hanako_cards = [] cards_size = n + m total = 0 t_total = 0 h_total = 0 for i in range(0,cards_size): point = int(input()) total += point if n...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,571
s119315253
p00734
u037441960
1589626550
Python
Python3
py
Accepted
30
5616
945
while True : n, m = map(int, input().split()) if n == 0 : break else : T = [] H = [] for i in range(n) : T.append(int(input())) for i in range(m) : H.append(int(input())) Ts = sorted(T) H...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,572
s886724640
p00734
u014861569
1589031294
Python
Python3
py
Accepted
40
5596
526
while True: s=[] t=[] n,m=map(int,input().split()) if n==0 and m==0: break else: for i in range(n): x=int(input()) s.append(x) for i in range(m): y=int(input()) t.append(y) s.sort() t.sort() def search():...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,573
s557872806
p00734
u240091169
1588906331
Python
Python3
py
Accepted
30
5612
1,082
while True : n, m = map(int, input().split()) if n == 0 and m == 0 : break list_n = list(int(input()) for i in range(n)) list_m = list(int(input()) for i in range(m)) list_n.sort list_m.sort sum_n = sum(list_n) sum_m = sum(list_m) if sum_n >= sum_m : sa = sum_n -...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,574
s260252389
p00734
u206124123
1587263227
Python
Python3
py
Accepted
30
5612
1,059
def get_two_int(): two_int = input().split() for i in range(2): two_int[i] = int(two_int[i]) return two_int def make_sorted_num_list(num): num_list = [None] * num for i in range(num): num_list[i] = int(input()) sorted_num_list = sorted(num_list) return sorted_num_list def s...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,575
s878173830
p00734
u572760146
1583883162
Python
Python3
py
Accepted
40
6244
535
while (True): n,m=map(int,input().split()) if n==m==0: exit() lst_a=[int(input()) for _ in range(n)] lst_b=[int(input()) for _ in range(m)] a_sum=sum(lst_a) b_sum=sum(lst_b) min_lst=[] for a in lst_a: keisan_a=a_sum keisan_b=b_sum for b in lst_b: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,576
s459054925
p00734
u821608651
1580217883
Python
Python3
py
Accepted
30
6036
1,196
import sys sys.setrecursionlimit(10 ** 6) from bisect import * from collections import * from heapq import * int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def SI(): return sys.stdin.readline()[:-1] def MI(): return map(int, sys.stdin.readline().split()) def...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,577
s269817603
p00734
u829695570
1578718226
Python
Python3
py
Accepted
20
5600
357
while 1: n,m = map(int,input().split()) if n==0: break t = sorted([int(input()) for _ in range(n)]) h = sorted([int(input()) for _ in range(m)]) d = sum(t) - sum(h) if d%2 != 0: print(-1);continue for i in range(n): if t[i] - d//2 in h: print(t[i], t[i] - d//2) ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,578
s150065589
p00734
u492405338
1575473804
Python
Python3
py
Accepted
50
5608
981
while 1: n, m = [int(i) for i in input().split()] if n == 0 and m == 0: break taro = [] hanako = [] for i in range(n): s = int(input()) taro.append(s) for i in range(m): s = int(input()) hanako.append(s) sum_taro = sum(taro) sum_hanako = su...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,579
s097563644
p00734
u803862921
1572059561
Python
Python3
py
Accepted
30
5604
542
while True: n, m = [int(x) for x in input().split()] if n == 0 and m == 0: break L = [] M = [] for _ in range(n): L.append(int(input())) for _ in range(m): M.append(int(input())) diff = sum(M) - sum(L) if diff %2: print(-1) continue else: ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,580
s520611275
p00734
u317942270
1562821147
Python
Python3
py
Accepted
40
5604
517
ans_list = [] while True: n,m = map(int,input().split()) if (n,m) == (0,0): break S = [int(input()) for _ in range(n)] T = [int(input()) for _ in range(m)] ss = sum(S) tt = sum(T) ans = (101,101) for s in S: for t in T: if ss - s + t == tt - t + s and s + t <...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,581
s816280349
p00734
u853158149
1562809567
Python
Python3
py
Accepted
40
5628
968
#2009_A """ def solve(n,p): a = [0]*n for _ in range(1000000): for i in range(n): if p: p -= 1 a[i] += 1 if p == 0: if sum(a)-a[i] == 0: return i else: p += a[i] ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,582
s167719372
p00734
u998734722
1562161407
Python
Python3
py
Accepted
100
6516
514
while True: n,m = map(int,input().split()) if n == 0: exit() t = [] h = [] ans = [] for i in range(n): t.append(int(input())) for i in range(m): h.append(int(input())) for i in range(n): for j in range(m): if (sum(t) - t[i] + h[j]) == (sum(h) -...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,583
s120478565
p00734
u629590130
1561869201
Python
Python3
py
Accepted
40
5660
418
from itertools import product while True: N, M = map(int, input().split()) if N==M==0: break A = [int(input()) for _ in range(N)] B = [int(input()) for _ in range(M)] sumA = sum(A) sumB = sum(B) ans = [-1] wa = float("inf") for (ia, a), (ib, b) in product(enumerate(A), enumerate(B)): if sumA -...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,584
s541431017
p00734
u464321546
1561801512
Python
Python3
py
Accepted
50
6372
490
def main(n, m): a = [int(input()) for i in range(n)] b = [int(input()) for i in range(m)] suma = sum(a) sumb = sum(b) ans = [] for ai in a: for bi in b: if suma - ai + bi == sumb - bi + ai: ans.append((ai, bi)) if ans == []: print(-1) retur...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,585
s826638627
p00734
u264450287
1561512505
Python
Python3
py
Accepted
100
5980
607
while True: n,m=map(int,input().split()) if n==0 and m==0: break tarou=[] hanako=[] kumit=[] kumih=[] wa=[] for i in range(n): tarou.append(int(input())) for i in range(m): hanako.append(int(input())) for i in range(n): a=tarou[i] for j in range(m): b=hanako[j] x=sum(...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,586
s458412627
p00734
u215870135
1561200170
Python
Python3
py
Accepted
30
5604
695
while True: n, m = map(int, input().split()) if n == 0: break a = [0] * n b = [0] * m sum_a = 0 sum_b = 0 for i in range(n): a[i] = int(input()) sum_a += a[i] for i in range(m): b[i] = int(input()) sum_b += b[i] a = sorted(a) b = sorted(b) ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,587
s262426626
p00734
u777299405
1560941285
Python
Python3
py
Accepted
30
5608
413
while True: n, m = map(int, input().split()) if n == 0: break ans = False taro = sorted([int(input()) for _ in range(n)]) hana = [int(input()) for _ in range(m)] diff = sum(taro) - sum(hana) hana = set(hana) for k in taro: if k - diff / 2 in hana: print(k, k -...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,588
s630466611
p00734
u237184581
1560653900
Python
Python3
py
Accepted
30
5596
775
def fun(n, m): n_total = 0 N = [] for _ in range(n): s = int(input()) N.append(s) n_total += s m_total = 0 M = [] for _ in range(m): s = int(input()) M.append(s) m_total += s ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,589
s509259568
p00734
u245823788
1560325893
Python
Python3
py
Accepted
40
5616
412
while True: n, m = list(map(int, input().split())) if n==0: break a = [int(input()) for i in range(n)] b = [int(input()) for i in range(m)] sa = sum(a) sb = sum(b) a.sort() b.sort() ta, tb = 1e9, 1e9 for i in range(n): for j in range(m): if (a[i]-b[j])*2==sa-sb: if ta+tb>a[i]...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,590
s487840129
p00734
u200148444
1560160414
Python
Python3
py
Accepted
30
5604
583
while True: n,m=map(int,input().split()) if n==0: break l1=[int(input()) for _ in range(n)] l2=[int(input()) for z in range(m)] sum1=sum(l1) sum2=sum(l2) l1.sort() l2.sort() a1=0 a2=0 while True: if a1+1>n or a2+1>m: print("-1") break ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,591
s927349179
p00734
u135085051
1559997897
Python
Python3
py
Accepted
30
5604
729
# Equal Total Scores ans = [] while True: flag = False n, m = map(int, input().split()) if n == 0 and m == 0: break s = [int(input()) for i in range(n)] t = [int(input()) for i in range(m)] sum_s = sum(s) sum_t = sum(t) for i in range(n): for j in range(m): ...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,592
s885321828
p00734
u701749469
1555835957
Python
Python3
py
Accepted
30
5624
1,592
CARDMAX = 100 POINTMAX = 100 def main(): head = [] c_taro = [] c_hana = [] while True: # 初期化 head.clear() c_taro.clear() c_hana.clear() # 先頭情報 head = input() head = head.split(" ") # 終了処理 if head == ['0', '0']: r...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,593
s103241733
p00734
u990228206
1554380122
Python
Python3
py
Accepted
20
5600
883
while 1: n,m=map(int,input().split()) if n==m==0:break taro=[] hana=[] for i in range(n):taro.append(int(input())) for i in range(m):hana.append(int(input())) s_t=sum(taro) s_h=sum(hana) if (s_t+s_h)%2==1:print(-1) else: if s_t==s_h: taro.sort() fo...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,594
s094871491
p00734
u598814210
1544703796
Python
Python3
py
Accepted
40
5624
503
while True: n, m = map(int, input().split()) if n == 0: break t = [int(input()) for i in range(n)] h = [int(input()) for i in range(m)] t_sum = sum(t) h_sum = sum(h) ans_sum = 10e9 ans = [0, 0] for ti in t: for hi in h: if t_sum - ti + hi == h_s...
p00734
<h1><font color="#000000">Problem A:</font> Equal Total Scores</h1> <!-- <img src="https://judgeapi.u-aizu.ac.jp/resources/images/A-1" width=300 align=left> --> <!-- begin en only --> <p> Taro and Hanako have numbers of cards in their hands. Each of the cards has a score on it. Taro and Hanako wish to make the tot...
2 2 1 5 3 7 6 5 3 9 5 2 3 3 12 2 7 3 5 4 5 10 0 3 8 1 9 6 0 6 7 4 1 1 2 1 2 1 4 2 3 4 3 2 3 1 1 2 2 2 0 0
1 3 3 5 -1 2 2 -1
24,595