96402024-02-23 16:57:42PallanekPéterFőzet készítéscpp17Wrong answer 0/50153ms6492 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
    vector<vector<int>> dp;
    dp.resize(501, vector<int>(501,0));
    for (int a=1; a<32; a++){
        for (int b=1; b<32; b++){
            if (__gcd(a,b)==1){
                for (int i=500; i>=a; i--) {
                    for (int j=500; j>=b; j--) {
                        dp[i][j]=max(dp[i][j],dp[i-a][j-b]+1);
                    }
                }
            }
        }
    }
    int t;
    cin >> t;
    for (int i=0; i<=t; i++) {
        int x, y;
        cin >> x >> y;
        cout << dp[x][y] << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/0149ms3832 KiB
2Wrong answer0/0151ms4108 KiB
3Wrong answer0/3149ms4372 KiB
4Wrong answer0/2148ms4436 KiB
5Wrong answer0/3148ms4388 KiB
6Wrong answer0/2149ms4880 KiB
7Wrong answer0/3150ms4916 KiB
8Wrong answer0/2150ms5048 KiB
9Wrong answer0/3151ms5196 KiB
10Wrong answer0/2152ms5204 KiB
11Wrong answer0/2151ms5164 KiB
12Wrong answer0/2151ms5720 KiB
13Wrong answer0/2152ms5752 KiB
14Wrong answer0/2151ms5872 KiB
15Wrong answer0/2151ms5732 KiB
16Wrong answer0/2151ms5912 KiB
17Wrong answer0/2152ms6188 KiB
18Wrong answer0/2152ms6140 KiB
19Wrong answer0/2153ms6344 KiB
20Wrong answer0/3153ms6220 KiB
21Wrong answer0/3153ms6216 KiB
22Wrong answer0/3152ms6492 KiB
23Wrong answer0/3153ms6492 KiB