結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 41 ms
12,288 KB
testcase_04 AC 137 ms
24,488 KB
testcase_05 AC 134 ms
24,588 KB
testcase_06 AC 136 ms
24,444 KB
testcase_07 AC 153 ms
24,508 KB
testcase_08 AC 153 ms
24,632 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 AC 106 ms
24,528 KB
testcase_11 AC 105 ms
24,376 KB
testcase_12 AC 104 ms
24,376 KB
testcase_13 AC 103 ms
24,512 KB
testcase_14 AC 107 ms
24,508 KB
testcase_15 AC 106 ms
24,508 KB
testcase_16 AC 123 ms
24,460 KB
testcase_17 AC 123 ms
24,508 KB
testcase_18 AC 32 ms
10,752 KB
testcase_19 AC 130 ms
24,872 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 31 ms
10,752 KB
testcase_23 AC 31 ms
10,752 KB
testcase_24 AC 126 ms
21,664 KB
testcase_25 AC 31 ms
10,752 KB
testcase_26 AC 31 ms
10,752 KB
testcase_27 AC 33 ms
10,752 KB
testcase_28 AC 32 ms
10,752 KB
testcase_29 AC 32 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 a%2==b%2 for a,b in zip(A,B)):
            ans=cnt
        else:
            ans=-1
print(ans)
0