CSES - Leirikisa 2 - Results
Submission details
Task:Kolikot
Sender:Kuha
Submission time:2016-07-28 14:29:01 +0300
Language:C++
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.06 sdetails
#2ACCEPTED0.05 sdetails
#3ACCEPTED0.05 sdetails
#4ACCEPTED0.05 sdetails
#5ACCEPTED0.05 sdetails
#6ACCEPTED0.07 sdetails
#7ACCEPTED0.07 sdetails
#8ACCEPTED0.07 sdetails
#9ACCEPTED0.07 sdetails
#10ACCEPTED0.05 sdetails

Code

#include <bits/stdc++.h>
#define ll long long
#define INF 999999999
#define N (1<<17)
#define M 1000000007

using namespace std;

ll dp[500001];

int main () {
  int n, x;
  cin>>n>>x;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin>>v[i];
  dp[0] = 1;
  for (int c = 0; c < n; c++) {
    for (int i = v[c]; i <= x; i++) {
      dp[i] = (dp[i] + dp[i - v[c]]) % M;
    }
  }
  cout<<dp[x]<<endl;
}

Test details

Test 1

Verdict: ACCEPTED

input
10 100
4 10 1 6 8 9 3 7 2 5

correct output
6292069

user output
6292069

Test 2

Verdict: ACCEPTED

input
10 100
15 13 6 1 19 2 12 7 17 11

correct output
137264

user output
137264

Test 3

Verdict: ACCEPTED

input
10 100
4 6 27 5 24 8 29 7 17 12

correct output
9127

user output
9127

Test 4

Verdict: ACCEPTED

input
10 100
27 5 36 34 4 28 29 18 1 26

correct output
4245

user output
4245

Test 5

Verdict: ACCEPTED

input
10 100
1 13 34 38 8 32 7 47 25 15

correct output
2448

user output
2448

Test 6

Verdict: ACCEPTED

input
100 100000
157 42 20 92 161 45 78 193 121...

correct output
965218376

user output
965218376

Test 7

Verdict: ACCEPTED

input
100 100000
128 91 277 255 36 274 15 110 4...

correct output
61380312

user output
61380312

Test 8

Verdict: ACCEPTED

input
100 100000
975 777 370 188 787 808 879 79...

correct output
44790529

user output
44790529

Test 9

Verdict: ACCEPTED

input
100 100000
2783 2426 2774 4245 1497 2915 ...

correct output
269131525

user output
269131525

Test 10

Verdict: ACCEPTED

input
100 100000
12852 43492 55488 16404 72089 ...

correct output
1128389

user output
1128389