/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 37ms 1.27 MiB
#3 Accepted 40ms 1.77 MiB
#4 Accepted 44ms 2.496 MiB

Code

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <numeric>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::cprint(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

using llong = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using II = pair<int,int>;

void solve(int L, int R, int X) {
   if (R - L < abs(X)) {
      cout << -1 << ' ' << -1 << '\n';
      return;
   }
   int q = L, p = L + abs(X);
   if (X < 0)
      swap(p, q);
   cout << p << ' ' << q << '\n';
}

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int TC;
   cin >> TC;
   FOR(tc, 1, TC) {
      int L, R, X;
      cin >> L >> R >> X;
      solve(L, R, X);
   }

   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 15:37:57
Judged At
2025-04-06 15:37:58
Judged By
Score
100
Total Time
44ms
Peak Memory
2.496 MiB