Submission #60637
ソースコード
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 39 40 41 42 | #include<bits/stdc++.h> #define lol long long #define gcd(x,y) __gcd(x,y) #define mt make_tuple #define mp make_pair #define fi first #define se second #define fixed(x) fixed<<setprecision(x) using namespace std; template < class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true ); } template < class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true ); } template < class A> inline lol abs (A &a) { return (a < 0 ? -a : a); } bool inLine( int x, int y, int mx, int my){ return (x>=0&&y>=0&&x<mx&&y<my);} const lol inf=(1LL<<62); const lol MOD=(1e9)+7; const lol mod=998244353; const int dx[]={1,0,-1,0,1,1,-1,-1}; const int dy[]={0,1,0,-1,1,-1,1,-1}; void OUT(string s); lol n,m,k; signed main(){ cin.tie(0); ios::sync_with_stdio( false ); cin >>n; int x;cin >>x; map<lol, int > ans; ans[0]=0; for ( int i=0;i<n;i++){ int w;cin >>w; map<lol, int > tmp; for (auto o:ans){ if (o.fi==0) tmp[o.fi+w]++; else tmp[o.fi+w]+=o.se; } for (auto o:tmp){ ans[o.fi]+=o.se; } } cout <<ans[x]<< '\n' ; return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 1235 - チーム虚無新人賞おめでとう! |
ユーザー名 | ei1923 |
投稿日時 | 2020-07-10 18:10:56 |
言語 | C++17 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 1141 Byte |
最大実行時間 | 39 ms |
最大メモリ使用量 | 932 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | R1910 | 1 / 1 | in01.text, in02.text, in03.text, in04.text, in05.text, in06.text, in07.text, in08.text, in09.text, in10.text, in11.text, in12.text, in13.text, in14.text, in15.text, in16.text, in17.text, in18.text, in19.text, in20.text |
2 | R1933 | 9 / 9 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
in01.text | AC | 39 ms | 604 KB |
1
|
2
|
in02.text | AC | 30 ms | 428 KB |
1
|
2
|
in03.text | AC | 28 ms | 384 KB |
1
|
2
|
in04.text | AC | 19 ms | 592 KB |
1
|
2
|
in05.text | AC | 23 ms | 544 KB |
1
|
2
|
in06.text | AC | 24 ms | 616 KB |
1
|
2
|
in07.text | AC | 19 ms | 556 KB |
1
|
2
|
in08.text | AC | 26 ms | 616 KB |
1
|
2
|
in09.text | AC | 24 ms | 808 KB |
1
|
2
|
in10.text | AC | 18 ms | 608 KB |
1
|
2
|
in11.text | AC | 24 ms | 688 KB |
1
|
2
|
in12.text | AC | 22 ms | 744 KB |
1
|
2
|
in13.text | AC | 26 ms | 536 KB |
1
|
2
|
in14.text | AC | 25 ms | 720 KB |
1
|
2
|
in15.text | AC | 23 ms | 640 KB |
1
|
2
|
in16.text | AC | 24 ms | 568 KB |
1
|
2
|
in17.text | AC | 17 ms | 644 KB |
1
|
2
|
in18.text | AC | 23 ms | 720 KB |
1
|
2
|
in19.text | AC | 30 ms | 768 KB |
1
|
2
|
in20.text | AC | 20 ms | 680 KB |
1
|
2
|
in21.text | AC | 36 ms | 724 KB |
2
|
|
in22.text | AC | 25 ms | 760 KB |
2
|
|
in23.text | AC | 17 ms | 784 KB |
2
|
|
in24.text | AC | 25 ms | 808 KB |
2
|
|
in25.text | AC | 19 ms | 712 KB |
2
|
|
in26.text | AC | 37 ms | 740 KB |
2
|
|
in27.text | AC | 19 ms | 772 KB |
2
|
|
in28.text | AC | 17 ms | 848 KB |
2
|
|
in29.text | AC | 22 ms | 932 KB |
2
|
|
in30.text | AC | 19 ms | 700 KB |
2
|