94542024-02-21 21:10:02ananászDinamitcpp17Wrong answer 8/508ms4040 KiB
// dinamit3.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>

using namespace std;


int main()
{	int N, M, K;
	cin >> N >> M >> K;
	vector<vector<vector<int>>>dp(N +1, vector<vector<int>>(M +1, vector<int>(K+1, 1000000)));
	vector<vector<int>>t(N +1, vector<int>(M +1));
	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= M; j++)
		{
			cin >> t[i][j];
		}
	}
	for (int k = 0; k <= K; k++)
	{
		for (int i = 1; i <= N; i++)
		{
			for (int j = 1; j <= M; j++)
			{
				int x = t[i][j];
				for (int l = 0; l <= k; l++)
				{
					if (i == 1 && j == 1) 
					{
						dp[i][j][k] = x;
					}
					else
					{
						dp[i][j][k] = min(dp[i][j][k], min(dp[i - 1][j][k - l], dp[i][j - 1][k - l]) + x);
						
					}
					x =x/2;
				}
			}
		}
	}
	
	cout << dp[N][M][K] << '\n';
	return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base8/50
1Accepted0/03ms1808 KiB
2Wrong answer0/08ms2780 KiB
3Wrong answer0/23ms2524 KiB
4Wrong answer0/23ms2756 KiB
5Wrong answer0/33ms2552 KiB
6Wrong answer0/33ms2672 KiB
7Accepted2/27ms3392 KiB
8Accepted3/38ms3604 KiB
9Wrong answer0/23ms3228 KiB
10Wrong answer0/23ms3124 KiB
11Wrong answer0/33ms3136 KiB
12Accepted3/33ms3204 KiB
13Wrong answer0/24ms3276 KiB
14Wrong answer0/34ms3276 KiB
15Wrong answer0/27ms3776 KiB
16Wrong answer0/37ms3816 KiB
17Wrong answer0/27ms3776 KiB
18Wrong answer0/37ms3776 KiB
19Wrong answer0/27ms4032 KiB
20Wrong answer0/37ms3792 KiB
21Wrong answer0/28ms4040 KiB
22Wrong answer0/37ms3988 KiB