Submission #2700903
Source Code Expand
#include <iostream> #include <vector> using namespace std; void comb(vector<vector <long long int> > &v) { for (int i = 0; i < v.size(); i++) { v[i][0] = 1; v[i][i] = 1; } for (int k = 0; k < v.size(); k++) { for (int j = 1; j < k; j++) { v[k][j] = (v[k-1][j-1] + v[k-1][j]); } } } int main() { int N, A, B, K; cin >> N >> A >> B >> K; vector<vector<long long int> > v(N + 1, vector<long long int>(N + 1, 0)); comb(v); int sum = 0; for (int a = 0; a <= N; a++) { for (int b = 0; b <= N; b++) { if (A * a + B * b == K) { sum += v[N][a] * v[N][b]; } } } cout << sum << endl; }
Submission Info
Submission Time | |
---|---|
Task | B - RGB Coloring |
User | asamasa612 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 669 Byte |
Status | RE |
Exec Time | 2077 ms |
Memory | 1780 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample01.txt, sample02.txt, sample03.txt |
All | sample01.txt, sample02.txt, sample03.txt, in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in20.txt, in21.txt, sample01.txt, sample02.txt, sample03.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | RE | 1469 ms | -932644 KB |
in02.txt | RE | 1515 ms | -932752 KB |
in03.txt | RE | 1910 ms | -932444 KB |
in04.txt | RE | 1645 ms | -932644 KB |
in05.txt | RE | 1523 ms | -932848 KB |
in06.txt | RE | 1674 ms | -931620 KB |
in07.txt | RE | 1418 ms | -931744 KB |
in08.txt | RE | 1678 ms | -932784 KB |
in09.txt | RE | 1425 ms | -933024 KB |
in10.txt | RE | 1521 ms | -933412 KB |
in11.txt | RE | 1574 ms | -932768 KB |
in12.txt | RE | 1564 ms | -932536 KB |
in13.txt | RE | 1473 ms | -933280 KB |
in14.txt | RE | 2077 ms | -931748 KB |
in15.txt | RE | 1475 ms | -931616 KB |
in16.txt | RE | 1580 ms | -932888 KB |
in17.txt | RE | 2074 ms | -932888 KB |
in18.txt | RE | 1885 ms | -932780 KB |
in19.txt | RE | 1474 ms | -932768 KB |
in20.txt | RE | 1494 ms | -933168 KB |
in21.txt | AC | 11 ms | 1780 KB |
sample01.txt | AC | 1 ms | 256 KB |
sample02.txt | AC | 1 ms | 256 KB |
sample03.txt | RE | 1966 ms | -931836 KB |