結果

問題 No.1120 Strange Teacher
ユーザー vwxyzvwxyz
提出日時 2024-04-11 13:24:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 432 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 24,820 KB
最終ジャッジ日時 2024-04-11 13:24:23
合計ジャッジ時間 4,952 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 53 ms
12,288 KB
testcase_04 AC 166 ms
24,376 KB
testcase_05 AC 133 ms
24,588 KB
testcase_06 AC 135 ms
24,488 KB
testcase_07 AC 131 ms
24,336 KB
testcase_08 AC 132 ms
24,464 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 102 ms
24,444 KB
testcase_11 AC 103 ms
24,508 KB
testcase_12 AC 101 ms
24,504 KB
testcase_13 AC 102 ms
24,380 KB
testcase_14 AC 118 ms
24,328 KB
testcase_15 AC 124 ms
24,336 KB
testcase_16 AC 119 ms
24,508 KB
testcase_17 AC 120 ms
24,380 KB
testcase_18 AC 29 ms
10,752 KB
testcase_19 AC 128 ms
24,820 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 30 ms
10,752 KB
testcase_23 AC 30 ms
10,752 KB
testcase_24 AC 125 ms
21,540 KB
testcase_25 AC 30 ms
10,752 KB
testcase_26 WA -
testcase_27 AC 30 ms
10,880 KB
testcase_28 AC 30 ms
10,752 KB
testcase_29 AC 30 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
D=[a-b for a,b in zip(A,B)]
if N==2:
    if sum(D)==0:
        ans=0
    else:
        ans=-1
else:
    if sum(D)<0 or sum(D)%(N-2):
        ans=-1
    else:
        cnt=sum(D)//(N-2)
        for i in range(N):
            A[i]-=cnt
        if all(a<=b and b%2==b%2 for a,b in zip(A,B)):
            ans=cnt
        else:
            ans=-1
print(ans)
0