184022025-10-21 17:15:20ubormaciPingpongcpp17Elfogadva 100/1006ms508 KiB
#include <iostream>
#include <algorithm> // for sort, mainly
#include <vector>
#include <map>
#include <set>
#include <cmath>
#include <array>
#include <string>
#include <cstdio>
#include <iterator>
#include <unordered_set>
#include <cstdint> // for int64_t, int32_t, etc
#include <queue>
#include <stack>
#include <deque>
#include <numeric> // gcd, lcm
#include <fstream>
#include <bitset> // for bitset
#include <iomanip>
#include <cassert> // for set with custom ordering
#include <type_traits> // for set with custom ordering
#include <utility> // for swap, forward, etc
using namespace std;

#pragma GCC optimize("O2")
// #pragma GCC optimize("O1","O2","O3","Ofast","unroll-loops")
// #pragma GCC target("sse","sse2","sse3","sse4.1","sse4.2","avx","avx2","fma")

template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
void dbg_out() { cout << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cout << ' ' << H; dbg_out(T...); }
#ifdef LOCAL
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

/*

notes:

int64_t
stoi(string s) -> string to int
to_string() -> int (or else) to string

vector declaration:
vector<ll> v(n, 0)
vector<vector<ll>> v(n, vector<ll>(n, 0));

{if statement} ? {truth value} : {false value}

#ifdef LOCAL
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif

std::lcm(ll a, ll b), std::gcd(int a, int b)

cout << fixed << setprecision(n);

set with custom ordering
set<ll, decltype(&cmp)> qu(cmp);

*/

typedef int64_t ll;

void solve() {

    ll a, b;
    cin >> a >> b;

    vector<ll> v(5, 0); // a score
    vector<ll> vb(5, 0); // b score
    
    if(a < 33) {
        cout << "-1 -1\n";
        return;
        // a needs to win at least 3 matches
    }

    ll ms = 3; // match size

    for(ll i = 0; i < 3; i++) {
        v[i] = 11;
    }
    
    if(a > 53) {
        cout << "-1 -1\n";
        return;
    }
    a -= 33;

    if(b > 52) {
        cout << "-1 -1\n";
        return;
    }
    if(b >= 22) {

        vb[3] = 11;
        vb[4] = 11;
        b -= 22;

    }else if(b >= 11) {

        vb[3] = 11;
        b -= 11;
    }

    for(ll i = 2; i >= 0; i--) {
        if(b > 10) {
            vb[i] = 10;
            b -= 10;
        }else{
            vb[i] = b;
            b = 0;
            break;
        }
    }

    for(ll i = 3; i <= 4; i++) {
        if(a > 10) {
            v[i] = 10;
            a -= 10;
        }else{
            v[i] = a;
            a = 0;
            break;
        }
    }

    for(ll i = 0; i <= 4; i++) {
        if(v[i] == 0 && vb[i] == 0) {
            break;
        }

        if(v[i] != 11 && vb[i] != 11) {
            cout << "-1 -1\n";
            return;
        }
    }

    for(ll i = 4; i >= 0; i--) {
        if(v[i] == 0 && vb[i] == 0) {
            continue;
        }
        cout << v[i] << " " << vb[i] << "\n";
    }

}

int main()
{
	std::ios_base::sync_with_stdio(false);
	//cin.tie(nullptr);
	//cout.tie(nullptr);

	ll tests = 0;
	cin >> tests;
 
	while(tests--)
	{
		solve();
	}

	return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
subtask10/0
1Elfogadva1ms508 KiB
subtask220/20
2Elfogadva1ms316 KiB
subtask330/30
3Elfogadva2ms316 KiB
subtask450/50
4Elfogadva4ms316 KiB
5Elfogadva6ms508 KiB
6Elfogadva6ms496 KiB