結果
問題 | No.1017 Reiwa Sequence |
ユーザー | beet |
提出日時 | 2020-03-11 20:41:40 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,176 bytes |
コンパイル時間 | 2,388 ms |
コンパイル使用メモリ | 204,540 KB |
実行使用メモリ | 75,320 KB |
最終ジャッジ日時 | 2023-09-15 22:45:17 |
合計ジャッジ時間 | 10,682 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
8,752 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,376 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 2 ms
4,380 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 97 ms
5,140 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 1,388 ms
37,516 KB |
testcase_13 | TLE | - |
testcase_14 | AC | 2 ms
4,384 KB |
testcase_15 | AC | 2 ms
4,384 KB |
testcase_16 | AC | 2 ms
4,504 KB |
testcase_17 | AC | 3 ms
4,384 KB |
testcase_18 | AC | 2 ms
4,384 KB |
testcase_19 | AC | 80 ms
5,204 KB |
testcase_20 | AC | 82 ms
5,164 KB |
testcase_21 | AC | 82 ms
5,396 KB |
testcase_22 | AC | 81 ms
5,200 KB |
testcase_23 | AC | 80 ms
5,084 KB |
testcase_24 | AC | 81 ms
5,312 KB |
testcase_25 | AC | 80 ms
5,124 KB |
testcase_26 | AC | 80 ms
5,208 KB |
testcase_27 | AC | 102 ms
5,140 KB |
testcase_28 | AC | 105 ms
5,212 KB |
testcase_29 | AC | 82 ms
5,144 KB |
testcase_30 | AC | 81 ms
5,148 KB |
testcase_31 | AC | 84 ms
5,128 KB |
testcase_32 | AC | 97 ms
5,076 KB |
testcase_33 | AC | 80 ms
5,136 KB |
testcase_34 | AC | 96 ms
5,212 KB |
testcase_35 | AC | 78 ms
5,400 KB |
testcase_36 | AC | 80 ms
5,184 KB |
testcase_37 | AC | 96 ms
5,200 KB |
testcase_38 | AC | 80 ms
5,204 KB |
testcase_39 | AC | 97 ms
5,344 KB |
testcase_40 | TLE | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
testcase_51 | -- | - |
testcase_52 | -- | - |
testcase_53 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} using Int = long long; const char newl = '\n'; //INSERT ABOVE HERE signed main(){ cin.tie(0); ios::sync_with_stdio(0); int n; cin>>n; vector<int> as(n); for(int i=0;i<n;i++) cin>>as[i]; int m=min(n,24); vector<int> cnt; for(int b=1;b<(1<<m);b++){ int sum=0; for(int i=0;i<m;i++) if((b>>i)&1) sum+=as[i]; cnt.emplace_back(sum); } sort(cnt.begin(),cnt.end()); for(int t=0;t+1<(int)cnt.size();t++){ if(cnt[t]==cnt[t+1]){ cout<<"Yes"<<endl; int sgn=1; vector<int> xs(n,0); for(int b=1;b<(1<<m);b++){ int sum=0; for(int i=0;i<m;i++) if((b>>i)&1) sum+=as[i]; if(sum!=cnt[t]) continue; for(int i=0;i<m;i++) if((b>>i)&1) xs[i]=sgn; if(sgn<0) break; sgn*=-1; } for(int i=0;i<n;i++){ if(i) cout<<" "; cout<<as[i]*xs[i]; } cout<<endl; return 0; } } cout<<"No"<<endl; return 0; }