/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 776.0 KiB
#2 Accepted 341ms 1.27 MiB
#3 Accepted 348ms 1.77 MiB
#4 Time Exceeded ≥1100ms ≥540.0 KiB

Code

/*Starting with the name of almighty ALLAH*/
/*Solved by 'Nazmul'*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define FAST_IO              \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 5;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
bool com(int a, int b) { return a > b ? true : false; }
ll power(ll base, ll exp)
{
    ll res = 1;
    base %= MOD;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res;
}

void solve()
{
    int a, b, x;
    cin >> a >> b >> x;
    if (abs(a - b) < abs(x))
        cout << -1 << " " << -1 << endl;
    else
    {

        for (auto i = a; i <= b; i++)
        {
            if (x < 0)
            {
                if (i - b == x)
                {
                    cout << i << " " << b << endl;
                    break;
                }
            }
            else
            {
                if (b - i == x)
                {
                    cout << b << " " << i << endl;
                    break;
                }
            }
        }
    }
    return;
}

int main()
{
    FAST_IO
    int t = 1;
    cin >> t;
    while (t--)
        solve();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1186 Equal to X
Contest
Brain Booster #9
Language
C++17 (G++ 13.2.0)
Submit At
2025-04-06 16:05:29
Judged At
2025-04-06 16:05:29
Judged By
Score
67
Total Time
≥1100ms
Peak Memory
≥1.77 MiB