Submission #124127

# Submission time Handle Problem Language Result Execution time Memory
124127 2019-07-02T14:40:30 Z RafikHachana Ice Hockey World Championship (CEOI15_bobek) C++14
20 / 100
1000 ms 66880 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long

int n;
vector<int> v;
map<pair<int,int>,int> m;

int dp(int i,int rem)
{
	if(rem<0) return 0;
	if(i==n) return 1;
	if(m.find({i,rem})!=m.end()) return m[{i,rem}];
	return m[{i,rem}] = dp(i+1,rem) + dp(i+1,rem-v[i]);
}

main()
{
	cin>>n;
	int w;
	cin>>w;
	v.resize(n);
	for(int i=0;i<n;i++) cin>>v[i];
	cout<<dp(0,w)<<endl;
}

Compilation message

bobek.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 356 KB Output is correct
2 Correct 2 ms 420 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 52 ms 5740 KB Output is correct
2 Correct 27 ms 3292 KB Output is correct
3 Correct 43 ms 4888 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Execution timed out 1054 ms 58564 KB Time limit exceeded
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 53868 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 315 ms 20336 KB Output is correct
2 Execution timed out 1081 ms 50816 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 756 ms 36568 KB Output is correct
2 Execution timed out 1064 ms 49236 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 52064 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1049 ms 62396 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 66880 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1047 ms 61968 KB Time limit exceeded
2 Halted 0 ms 0 KB -