43342023-03-25 12:34:52horvathabelFőzet készítéscpp17Wrong answer 10/50160ms6524 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
vector<vector<int>> dp;
dp.resize(501, vector<int>(501,0));
dp[1][1]=1;
dp[0][0]=1; 
for (int i=1; i<33;i++){
	for (int j=1; j<33;j++){
		if (__gcd(i,j)==1){
		for (int k=500;k>=i;k--){
			for (int z=500;z>=j;z--){
				dp[k][z]=max(dp[k][z],dp[k-i][z-j]+1);		
	
				}
		}
	}
}
}
	int t;
	cin>>t; 
	for (int i=0; i<t;i++){
		int a,b;
		cin>>a>>b;
		cout<<dp[a][b]-1<<endl;
	}
}
SubtaskSumTestVerdictTimeMemory
base10/50
1Accepted0/0155ms3836 KiB
2Wrong answer0/0158ms4032 KiB
3Accepted3/3156ms4240 KiB
4Accepted2/2156ms4452 KiB
5Accepted3/3156ms4664 KiB
6Accepted2/2156ms5020 KiB
7Wrong answer0/3159ms5156 KiB
8Wrong answer0/2158ms5276 KiB
9Wrong answer0/3158ms5112 KiB
10Wrong answer0/2159ms5256 KiB
11Wrong answer0/2158ms5112 KiB
12Wrong answer0/2158ms5116 KiB
13Wrong answer0/2158ms5112 KiB
14Wrong answer0/2160ms5368 KiB
15Wrong answer0/2158ms5580 KiB
16Wrong answer0/2159ms5540 KiB
17Wrong answer0/2158ms5952 KiB
18Wrong answer0/2158ms5996 KiB
19Wrong answer0/2158ms5956 KiB
20Wrong answer0/3160ms6216 KiB
21Wrong answer0/3160ms6432 KiB
22Wrong answer0/3160ms6264 KiB
23Wrong answer0/3160ms6524 KiB