/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 344.0 KiB
#2 Accepted 37ms 1.316 MiB
#3 Accepted 49ms 1.77 MiB
#4 Accepted 67ms 2.309 MiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define ff first
#define ss second
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define f(i,x,y) for(int i=x;i<y;i++)
#define f2(i,x,y) for(int i=x;i>=y;i--)
#define pii pair<int,int>
#define Fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int MOD =1000000007;
const int INF = 1e18;
const int N = 2e5;
 
void solve(int tc){
    int l,r,x; cin >> l >> r >> x;
    if(x == 0)cout << l << " " << l << endl;
    else if(x > 0){
        (l + x <= r ? cout << l + x << " " << l << endl : cout << -1 << " " << -1 << endl);
    }
    else {
        (r + x >= l ? cout << r + x << " " << r << endl : cout << -1 << " " << -1 << endl);
    }
        
}
int32_t main(){

    Fast

    int t=1;

    cin >> t;

    for(int tc=1;tc<=t;tc++){

        solve(tc);
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1186 Equal to X
Language
C++17 (G++ 13.2.0)
Submit At
2025-04-07 23:03:00
Judged At
2025-04-07 23:03:00
Judged By
Score
100
Total Time
67ms
Peak Memory
2.309 MiB