QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#237523#7642. Integer Half-Sumucup-team859#AC ✓0ms3824kbC++231.5kb2023-11-04 14:21:152023-11-04 14:21:17

Judging History

This is the latest submission verdict.

  • [2023-11-04 14:21:17]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3824kb
  • [2023-11-04 14:21:15]
  • Submitted

answer

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

using ll = long long;
using ull = unsigned long long;

string to_string(const string &s) {
  return '"' + s + '"';
}

string to_string(bool b) {
  return b ? "true" : "false";
}

template <typename A, typename B>
string to_string(const pair<A, B> &p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename T>
string to_string(const T &v) {
  string s = "{";
  bool first = true;
  for (const auto &it : v) {
    if (!first)
      s += ", ";
    else
      first = false;
    s += to_string(it);
  }
  return s += "}";
}

void debug_out() {
  cerr << endl;
}

template <typename T, typename... Args>
void debug_out(const T &first, const Args&... rest) {
  cerr << to_string(first) << " ";
  debug_out(rest...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

auto startTime = high_resolution_clock::now();
int get_time() {
  auto stopTime = chrono::high_resolution_clock::now();
  auto duration = duration_cast<milliseconds>(stopTime - startTime);
  return duration.count(); // in ms
}

void solve() {
  int l, r;
  cin >> l >> r;
  if (l == r)
    cout << l << "\n";
  else if (l == r - 1)
    cout << "-1\n";
  else
    cout << r - 1 << '\n';
}

int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);

  int t = 1;
//  cin >> t;
  while (t--)
    solve();

  return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3780kb

input:

2 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

1 1

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

1 2

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

100 100

output:

100

result:

ok 1 number(s): "100"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

99 100

output:

-1

result:

ok 1 number(s): "-1"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

3 3

output:

3

result:

ok 1 number(s): "3"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

2 3

output:

-1

result:

ok 1 number(s): "-1"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

1 3

output:

2

result:

ok 1 number(s): "2"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 5

output:

4

result:

ok 1 number(s): "4"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

3 7

output:

6

result:

ok 1 number(s): "6"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

3 8

output:

7

result:

ok 1 number(s): "7"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

4 10

output:

9

result:

ok 1 number(s): "9"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

35 37

output:

36

result:

ok 1 number(s): "36"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

43 46

output:

45

result:

ok 1 number(s): "45"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

82 86

output:

85

result:

ok 1 number(s): "85"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

55 60

output:

59

result:

ok 1 number(s): "59"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

25 31

output:

30

result:

ok 1 number(s): "30"

Test #18:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

37 44

output:

43

result:

ok 1 number(s): "43"

Test #19:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

75 83

output:

82

result:

ok 1 number(s): "82"

Test #20:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

74 83

output:

82

result:

ok 1 number(s): "82"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

88 98

output:

97

result:

ok 1 number(s): "97"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3780kb

input:

75 86

output:

85

result:

ok 1 number(s): "85"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1 100

output:

99

result:

ok 1 number(s): "99"

Test #24:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

1 50

output:

49

result:

ok 1 number(s): "49"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

50 100

output:

99

result:

ok 1 number(s): "99"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

7 35

output:

34

result:

ok 1 number(s): "34"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

87 95

output:

94

result:

ok 1 number(s): "94"

Test #28:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

11 30

output:

29

result:

ok 1 number(s): "29"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

47 69

output:

68

result:

ok 1 number(s): "68"

Test #30:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

11 48

output:

47

result:

ok 1 number(s): "47"

Test #31:

score: 0
Accepted
time: 0ms
memory: 3520kb

input:

71 85

output:

84

result:

ok 1 number(s): "84"

Test #32:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

84 89

output:

88

result:

ok 1 number(s): "88"

Test #33:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

22 56

output:

55

result:

ok 1 number(s): "55"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

2 72

output:

71

result:

ok 1 number(s): "71"

Test #35:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

18 55

output:

54

result:

ok 1 number(s): "54"

Test #36:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

4 11

output:

10

result:

ok 1 number(s): "10"

Test #37:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

42 59

output:

58

result:

ok 1 number(s): "58"

Test #38:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

52 79

output:

78

result:

ok 1 number(s): "78"

Test #39:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

11 48

output:

47

result:

ok 1 number(s): "47"

Test #40:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

4 51

output:

50

result:

ok 1 number(s): "50"

Test #41:

score: 0
Accepted
time: 0ms
memory: 3824kb

input:

3 60

output:

59

result:

ok 1 number(s): "59"

Test #42:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

21 88

output:

87

result:

ok 1 number(s): "87"

Test #43:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

17 94

output:

93

result:

ok 1 number(s): "93"

Test #44:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

11 98

output:

97

result:

ok 1 number(s): "97"

Test #45:

score: 0
Accepted
time: 0ms
memory: 3776kb

input:

2 99

output:

98

result:

ok 1 number(s): "98"

Extra Test:

score: 0
Extra Test Passed