結果
問題 |
No.1701 half price
|
ユーザー |
![]() |
提出日時 | 2023-08-10 05:08:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 918 bytes |
コンパイル時間 | 3,439 ms |
コンパイル使用メモリ | 256,024 KB |
最終ジャッジ日時 | 2025-02-16 00:28:44 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 WA * 4 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace atcoder; using namespace std; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll mod=1000000007; ll inf=10099999999999990; int main(){ ll n,w; cin >> n >> w; vector<ll>a(n); for (ll i = 0; i < n; i++) { cin >> a[i]; } vector<ll>thr(20,1),two(20,1); for (ll i = 1; i < 20; i++) { thr[i]=thr[i-1]*3; two[i]=two[i-1]*2; } ll ans=0; map<ll,ll>memo; for (ll i = 0; i <thr[n] ; i++) { ll x=0; ll z=0; for (ll j = 0; j < n; j++) { ll y=i%thr[j+1]; y/=thr[j]; x+=(a[j]*y)/2; if (y>=1) { z+=two[j]; } } if (x==w) { memo[z]++; } }for(auto v:memo){ ans++; } cout << ans << endl; }