Task: | Zbrka |
Sender: | henrikaalto |
Submission time: | 2019-07-26 14:48:25 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | ACCEPTED | 0.01 s | details |
#9 | ACCEPTED | 0.01 s | details |
#10 | ACCEPTED | 0.06 s | details |
#11 | ACCEPTED | 0.09 s | details |
#12 | ACCEPTED | 0.11 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d%d", &n, &c); ~~~~~^~~~~~~~~~~~~~~~
Code
#pragma GCC optimize("O3") #include<stdio.h> using ii=long; const ii mod=1e9+7; ii dp[2][10001]; int main() { int n,c; scanf("%d%d", &n, &c); int z = 1; dp[z][0] = 1; for (int i = 2; i <= n; ++i) { z = !z; ii s = 0; for (int y = 0; y <= c; ++y) { s += dp[!z][y]; s %= mod; if (y - i >= 0) s -= dp[!z][y - i]; s += mod; s %= mod; (dp[z][y] = s) %= mod; } } printf("%ld\n", dp[z][c]); }
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: ACCEPTED
input |
---|
432 10000 |
correct output |
---|
532401236 |
user output |
---|
532401236 |
Test 8
Verdict: ACCEPTED
input |
---|
987 4 |
correct output |
---|
621481900 |
user output |
---|
621481900 |
Test 9
Verdict: ACCEPTED
input |
---|
999 931 |
correct output |
---|
502211067 |
user output |
---|
502211067 |
Test 10
Verdict: ACCEPTED
input |
---|
999 5000 |
correct output |
---|
722028249 |
user output |
---|
722028249 |
Test 11
Verdict: ACCEPTED
input |
---|
999 8234 |
correct output |
---|
263421764 |
user output |
---|
263421764 |
Test 12
Verdict: ACCEPTED
input |
---|
1000 10000 |
correct output |
---|
463544056 |
user output |
---|
463544056 |