36882023-03-02 10:50:31kovacs.peter.18fJáték (50 pont)cpp11Time limit exceeded 32/50165ms4364 KiB
#include <iostream>
#include <vector>

#define MOD 1000000007

using namespace std;

int main() {
	cin.sync_with_stdio(false);
	cin.tie(nullptr);

	int b, c;
	cin >> b >> c;
	int x = b - 1, y = c - b - 1;
	if (x == 0) {
		x = 1;
		y -= 1;
	}
	int sorok = y + 1, oszlopok = x + y;
	vector<vector<int>> dpS(2, vector<int>(oszlopok));
	for (int i = 0; i < sorok; i++) {
		for (int j = 0; j < (oszlopok - i); j++) {
			if (i == 0) {
				dpS[i % 2][j] = (j + 2) % MOD;
			}
			else if (j == 0) {
				dpS[i % 2][j] = (dpS[(i + 1) % 2][j] + dpS[(i + 1) % 2][j + 1]) % MOD;
			}
			else {
				dpS[i % 2][j] = (dpS[i % 2][j - 1] + dpS[(i + 1) % 2][j + 1]) % MOD;
			}
		}
	}
	cout << dpS[1 - sorok % 2][x - 1] << '\n';
}
SubtaskSumTestVerdictTimeMemory
base32/50
1Accepted0/03ms1824 KiB
2Accepted0/03ms2168 KiB
3Accepted2/23ms2488 KiB
4Accepted3/33ms2624 KiB
5Accepted3/32ms2708 KiB
6Accepted3/33ms2900 KiB
7Accepted3/34ms3048 KiB
8Accepted3/37ms3152 KiB
9Accepted3/310ms3388 KiB
10Accepted3/39ms3460 KiB
11Accepted3/332ms3568 KiB
12Accepted3/352ms3592 KiB
13Accepted3/330ms3900 KiB
14Time limit exceeded0/3152ms3868 KiB
15Time limit exceeded0/3165ms3504 KiB
16Time limit exceeded0/3146ms4364 KiB
17Time limit exceeded0/3163ms3956 KiB
18Time limit exceeded0/3150ms4248 KiB
19Time limit exceeded0/3158ms4204 KiB