Task: | Kortit II |
Sender: | alberthenriksson |
Submission time: | 2024-10-31 15:09:22 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
#4 | RUNTIME ERROR | 0 |
#5 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.39 s | 1, 2, 3, 4, 5 | details |
#2 | RUNTIME ERROR | 0.39 s | 2, 3, 4, 5 | details |
#3 | RUNTIME ERROR | 0.39 s | 3, 4, 5 | details |
#4 | RUNTIME ERROR | 0.39 s | 4, 5 | details |
#5 | RUNTIME ERROR | 0.40 s | 5 | details |
#6 | RUNTIME ERROR | 0.39 s | 5 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:26:13: warning: unused variable 'ffinal' [-Wunused-variable] 26 | int ffinal; | ^~~~~~ input/code.cpp:27:13: warning: variable 'equal' set but not used [-Wunused-but-set-variable] 27 | int equal; | ^~~~~ input/code.cpp:45:49: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds] 45 | if (d[i][2] == d[i][1] || d[i][3] == d[i][1] || d[i][2] + d[i][3] > d[i][1]) { | ~~~~~~^ input/code.cpp:20:5: note: while referencing 'd' 20 | int d[2005][3]; | ^ input/code.cpp:49:44: warning: array subscript 3 is above array bounds of 'int [3]' [-Warray-bounds] 49 | if (d[i][2] == 0 and d[i][3] != 0) { | ~~~~~~^ input/code.cpp:20:5: note: while referencing 'd' 20 | int d[2005][3]; | ^ input/code.cpp:55:27: warning:...
Code
#include <iostream> using namespace std; int f[2005][2005]; int funktio(int n, int c) { int u; if (c == 1) { return 1; } else { u = c * funktio(n - 1, c) + (n - c) * funktio(n - 1, c - 1) + (n - 1) * funktio(n - 2, c - 1); f[n][c] = u; } return u; } int fac[2005]; int d[2005][3]; int main() { fac[1] = 1; int p = 1e9 + 7; int final; int ffinal; int equal; for (int i = 1; i <= 2000; i++) { f[i][1] = 1; } for (int i = 2; i <= 2000; i++) { fac[i] = (i * fac[i - 1]) % p; } int t; cin >> t; int pass = 0; for (int i = 1; i <= t; i++) { int a, b, n; cin >> n >> a >> b; d[i][1] = n; d[i][2] = a; d[i][3] = b; } for (int i = 1; i <= t; i++) { if (d[i][2] == d[i][1] || d[i][3] == d[i][1] || d[i][2] + d[i][3] > d[i][1]) { cout << 0 << "\n"; pass = 1; } if (d[i][2] == 0 and d[i][3] != 0) { if (pass == 0) { cout << 0 << "\n"; pass = 2; } } if (d[i][3] == 0 and d[i][2] != 0) { if (pass == 0) { cout << 0 << "\n"; pass = 3; } } if (pass == 0) { equal = d[i][1] - d[i][2] - d[i][3]; final = funktio(d[i][2] + d[i][3], d[i][2]); cout << final; } pass = 0; } }
Test details
Test 1
Group: 1, 2, 3, 4, 5
Verdict: RUNTIME ERROR
input |
---|
54 4 4 0 3 1 3 3 2 2 4 0 4 ... |
correct output |
---|
0 0 0 0 0 ... |
user output |
---|
(empty) |
Test 2
Group: 2, 3, 4, 5
Verdict: RUNTIME ERROR
input |
---|
284 6 1 0 5 0 2 7 1 5 7 7 5 ... |
correct output |
---|
0 0 35280 0 36720 ... |
user output |
---|
(empty) |
Test 3
Group: 3, 4, 5
Verdict: RUNTIME ERROR
input |
---|
841 19 3 12 19 19 13 19 7 13 20 11 15 ... |
correct output |
---|
40291066 0 0 0 0 ... |
user output |
---|
(empty) |
Test 4
Group: 4, 5
Verdict: RUNTIME ERROR
input |
---|
1000 15 12 6 7 1 6 44 4 26 6 6 5 ... |
correct output |
---|
0 5040 494558320 0 340694548 ... |
user output |
---|
(empty) |
Test 5
Group: 5
Verdict: RUNTIME ERROR
input |
---|
1000 892 638 599 966 429 655 1353 576 1140 1403 381 910 ... |
correct output |
---|
0 0 0 249098285 0 ... |
user output |
---|
(empty) |
Test 6
Group: 5
Verdict: RUNTIME ERROR
input |
---|
1000 2000 1107 508 2000 1372 249 2000 588 65 2000 1739 78 ... |
correct output |
---|
750840601 678722180 744501884 159164549 868115056 ... |
user output |
---|
(empty) |