# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
461162 | 2021-08-09T12:53:50 Z | vanic | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 1000 ms | 7424 KB |
#include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <vector> using namespace std; typedef long long ll; const int maxn=45; ll a[maxn]; ll pref[maxn]; ll sol; void rijesi(int x, ll sum){ if(sum<0){ return; } if(sum>=pref[x+1]){ sol+=(1ll<<(x+1)); return; } sol++; for(int i=x; i>-1; i--){ rijesi(i-1, sum-a[i]); } } const int maxm=1e6+5; ll dp[maxm]; int n; ll m; void rokaj(){ dp[0]=1; for(int i=0; i<n; i++){ for(int j=m; j>=a[i]; j--){ dp[j]+=dp[j-a[i]]; } } for(int i=0; i<=m; i++){ sol+=dp[i]; } } int main(){ scanf("%d%lld", &n, &m); for(int i=0; i<n; i++){ scanf("%lld", a+i); } sort(a, a+n); for(int i=0; i<n; i++){ pref[i+1]=pref[i]+a[i]; } if(m<=1e6){ rokaj(); } else{ rijesi(n-1, m); } printf("%lld\n", sol); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 6476 KB | Output is correct |
2 | Correct | 5 ms | 3916 KB | Output is correct |
3 | Correct | 4 ms | 3532 KB | Output is correct |
4 | Correct | 7 ms | 5484 KB | Output is correct |
5 | Correct | 1 ms | 304 KB | Output is correct |
6 | Correct | 11 ms | 6556 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 300 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 320 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 460 KB | Output is correct |
2 | Correct | 18 ms | 5020 KB | Output is correct |
3 | Correct | 39 ms | 7424 KB | Output is correct |
4 | Correct | 16 ms | 4812 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 4 ms | 1612 KB | Output is correct |
7 | Correct | 1 ms | 304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 588 KB | Output is correct |
2 | Correct | 7 ms | 2124 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 4 ms | 3020 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 23 ms | 7108 KB | Output is correct |
7 | Correct | 1 ms | 332 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 4408 KB | Output is correct |
2 | Correct | 8 ms | 2508 KB | Output is correct |
3 | Correct | 9 ms | 2472 KB | Output is correct |
4 | Correct | 2 ms | 844 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 14 ms | 4092 KB | Output is correct |
7 | Correct | 2 ms | 2868 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1090 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 720 ms | 284 KB | Output is correct |
2 | Execution timed out | 1084 ms | 204 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1096 ms | 204 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |