CSES - COCI 2006/2007 #4 - Results
Submission details
Task:Zbrka
Sender:henrikaalto
Submission time:2019-07-26 14:34:46 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.01 sdetails
#7--details
#8ACCEPTED0.01 sdetails
#9--details
#10--details
#11--details
#12--details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &c);
     ~~~~~^~~~~~~~~~~~~~~~

Code

#include<stdio.h>
using ii=long;
const ii mod=1e9+7;
ii dp[1001][10001];
int main()
{
    int n,c;
    scanf("%d%d", &n, &c);
    // dp[i][j] = kuinka monella eri permutaatiolla luvuista 1 - i saa tasan j inversiota
    dp[1][0] = 1;
    for (int i = 2; i <= n; ++i) {
        for (int j = 0; j < i; ++j) {
            int perms = j;
            for (int y = perms; y <= c; ++y) {
                (dp[i][y] += dp[i - 1][y - perms]) %= mod;
                //printf("dp[%d][%d] += dp[%d][%d]\n", i, j, i - 1, y - perms);
            }
        }
    }
    printf("%ld\n", dp[n][c]);
    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= c; ++j) if (dp[i][j]) {
            //printf("pituus:\t %d\tpermutaatiot:\t%d\t=\t%ld\n", i, j, dp[i][j]);
        }
    }
}

Test details

Test 1

Verdict: ACCEPTED

input
1 1

correct output
0

user output
0

Test 2

Verdict: ACCEPTED

input
9 36

correct output
1

user output
1

Test 3

Verdict: ACCEPTED

input
9 37

correct output
0

user output
0

Test 4

Verdict: ACCEPTED

input
20 191

correct output
0

user output
0

Test 5

Verdict: ACCEPTED

input
51 93

correct output
652564375

user output
652564375

Test 6

Verdict: ACCEPTED

input
150 15

correct output
906085333

user output
906085333

Test 7

Verdict:

input
432 10000

correct output
532401236

user output
(empty)

Test 8

Verdict: ACCEPTED

input
987 4

correct output
621481900

user output
621481900

Test 9

Verdict:

input
999 931

correct output
502211067

user output
(empty)

Test 10

Verdict:

input
999 5000

correct output
722028249

user output
(empty)

Test 11

Verdict:

input
999 8234

correct output
263421764

user output
(empty)

Test 12

Verdict:

input
1000 10000

correct output
463544056

user output
(empty)