結果

問題 No.4 おもりと天秤
ユーザー StarMatyan
提出日時 2018-07-22 17:56:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 748 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-26 05:16:10
合計ジャッジ時間 2,290 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 4
権限があれば一括ダウンロードができます

ソースコード

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