結果
| 問題 |
No.1701 half price
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-15 07:15:26 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 471 bytes |
| コンパイル時間 | 3,375 ms |
| コンパイル使用メモリ | 278,352 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-09-15 07:15:31 |
| 合計ジャッジ時間 | 4,259 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, w;
cin >> n >> w;
vector<int> a(n);
for(auto&e:a) cin >> e;
long ans = 0;
for(int i = 0; i < 1 << n; i++) {
long t = 0;
for(int j = 0; j < n; j++) if(i >> j & 1) t += a[j];
ans += t == w;
for(int j = 0; j < n; j++) if(i >> j & 1) {
t -= a[j] - a[j]/2;
ans += t == w;
t += a[j] - a[j]/2;
}
}
cout << ans << "\n";
}