Submission #57080
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include <bits/stdc++.h> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio( false ); long long n,q,a[1000000],x[100000],ans1[100000],num[30],c,d=0; cin>>n>>q; for ( int i=0;i<n;i++){ cin>>c; c+=10; if (num[c]!=1){ a[d]=c-10; num[c]=1; d++; } } for ( int i=0;i<q;i++){ cin>>x[i]; } for ( int bit =0;bit<(1<<d);bit++){ int b=0; for ( int i=0;i<d;i++){ if (bit & (1<<i)){ b+=a[i]; } } ans1[b+500]=1; //cout<<b<<endl; } for ( int i=0;i<q;i++){ if (x[i]>=-210 && x[i]<=210 && ans1[x[i]+500]==1){ cout<< "Possible" <<endl; } else cout<< "Impossible" <<endl; } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 1217 - Properly Choosing |
ユーザー名 | ei1903 |
投稿日時 | 2019-12-10 16:32:33 |
言語 | C++14 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 600 Byte |
最大実行時間 | 341 ms |
最大メモリ使用量 | 20020 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | in* |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01-01.txt | AC | 29 ms | 2652 KB |
1
|
in01-02.txt | AC | 20 ms | 416 KB |
1
|
in01-03.txt | AC | 40 ms | 2652 KB |
1
|
in01-04.txt | AC | 191 ms | 2260 KB |
1
|
in01-05.txt | AC | 24 ms | 3596 KB |
1
|
in01-06.txt | AC | 195 ms | 5332 KB |
1
|
in01-07.txt | AC | 331 ms | 4228 KB |
1
|
in01-08.txt | AC | 332 ms | 7100 KB |
1
|
in01-09.txt | AC | 195 ms | 7800 KB |
1
|
in01-10.txt | AC | 200 ms | 8920 KB |
1
|
in01-11.txt | AC | 203 ms | 10408 KB |
1
|
in01-12.txt | AC | 341 ms | 11356 KB |
1
|
in02-01.txt | AC | 25 ms | 10512 KB |
1
|
in02-02.txt | AC | 197 ms | 12252 KB |
1
|
in02-03.txt | AC | 206 ms | 13212 KB |
1
|
in02-04.txt | AC | 23 ms | 12752 KB |
1
|
in02-05.txt | AC | 230 ms | 12560 KB |
1
|
in02-06.txt | AC | 224 ms | 15556 KB |
1
|
in02-07.txt | AC | 240 ms | 16264 KB |
1
|
in02-08.txt | AC | 246 ms | 17864 KB |
1
|
in02-09.txt | AC | 284 ms | 16896 KB |
1
|
in02-10.txt | AC | 229 ms | 20020 KB |
1
|
sample01.txt | AC | 25 ms | 19180 KB | |
sample02.txt | AC | 21 ms | 19120 KB |