結果

問題 No.4 おもりと天秤
コンテスト
ユーザー id-ord
提出日時 2026-01-10 13:51:58
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 304 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,660 ms
コンパイル使用メモリ 168,000 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-01-10 13:52:02
合計ジャッジ時間 2,838 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>
int main(){
	int N;std::cin>>N;
	std::vector<int> W(N);for(auto& w:W)std::cin>>w;
	int sum=0;
	for(auto& w:W)sum+=w;
	std::vector<bool> X(2*sum+1);
	X[0]=1;
	for(auto& w:W)for(int i=2*w;i<=2*sum;i++)X[i]=X[i-2*w]|X[i];
	std::cout<<(X[sum]?"possible":"impossible");
}
0