結果

問題 No.4 おもりと天秤
ユーザー StarMatyanStarMatyan
提出日時 2018-07-22 17:56:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 748 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 7,980 KB
最終ジャッジ日時 2023-08-27 00:55:30
合計ジャッジ時間 1,892 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 16 ms
7,856 KB
testcase_02 AC 16 ms
7,800 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 16 ms
7,876 KB
testcase_06 AC 16 ms
7,928 KB
testcase_07 AC 16 ms
7,724 KB
testcase_08 AC 15 ms
7,824 KB
testcase_09 AC 16 ms
7,804 KB
testcase_10 WA -
testcase_11 AC 15 ms
7,796 KB
testcase_12 AC 15 ms
7,788 KB
testcase_13 AC 16 ms
7,820 KB
testcase_14 AC 16 ms
7,804 KB
testcase_15 AC 15 ms
7,792 KB
testcase_16 WA -
testcase_17 AC 16 ms
7,756 KB
testcase_18 AC 16 ms
7,888 KB
testcase_19 AC 16 ms
7,836 KB
testcase_20 AC 16 ms
7,760 KB
testcase_21 AC 16 ms
7,864 KB
testcase_22 AC 16 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Ndata = int(input());
itiran = input();
itirandata = itiran.split(" ");
itirannumdata = sorted(itirandata,key= int);
sumtmp = 0;
results = 0;
result = "";
kanren = 0;

for indexer in range(0,Ndata):
	sumtmp = sumtmp + int(itirannumdata[indexer]);


if sumtmp % 2 == 0:
    sumtmp = int(sumtmp / 2);
    firstkansu = Ndata -1;
    while firstkansu >= 0:
        kanren = int(itirannumdata[firstkansu]);
        results = results + kanren;
        if results > sumtmp:
            results = results - kanren;
            
        if firstkansu == 0 and results == sumtmp:
            result = "possible";
        else:
            result = "impossible";
            
        firstkansu = firstkansu - 1;
else:
	result = "impossible";
	
print(result);
0