116382024-11-02 12:03:21MagyarKendeSZLGFőzet készítéscpp17Wrong answer 20/5045ms1592 KiB
// huge if works
#pragma GCC optimize("Ofast,unroll-loops")

#include <bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(0), ios::sync_with_stdio(0);

    vector dp(501, vector<int>(501));
    for (int i = 1; i < 25; i++) {
        for (int j = 1; j < 25; j++) {
            if (gcd(i, j) > 1) continue;
            for (int k = 500; k >= i; k--) {
                for (int l = 500; l >= j; l--) {
                    dp[k][l] =
                        max(dp[k][l], dp[k - i][l - j] + 1);
                }
            }
        }
    }

    int T;
    cin >> T;
    while (T--) {
        int A, B;
        cin >> A >> B;
        cout << dp[A][B] << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base20/50
1Accepted0/043ms1340 KiB
2Accepted0/043ms1336 KiB
3Accepted3/343ms1340 KiB
4Accepted2/243ms1336 KiB
5Accepted3/343ms1560 KiB
6Accepted2/243ms1336 KiB
7Accepted3/343ms1336 KiB
8Accepted2/243ms1336 KiB
9Accepted3/343ms1336 KiB
10Accepted2/243ms1336 KiB
11Wrong answer0/243ms1592 KiB
12Wrong answer0/243ms1524 KiB
13Wrong answer0/243ms1528 KiB
14Wrong answer0/243ms1420 KiB
15Wrong answer0/243ms1336 KiB
16Wrong answer0/243ms1524 KiB
17Wrong answer0/243ms1420 KiB
18Wrong answer0/243ms1420 KiB
19Wrong answer0/243ms1428 KiB
20Wrong answer0/343ms1528 KiB
21Wrong answer0/345ms1336 KiB
22Wrong answer0/343ms1524 KiB
23Wrong answer0/343ms1336 KiB