QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501720#7642. Integer Half-SumSakib_Safwan#AC ✓0ms3708kbC++202.1kb2024-08-02 22:12:032024-08-02 22:12:03

Judging History

This is the latest submission verdict.

  • [2024-08-02 22:12:03]
  • Judged
  • Verdict: AC
  • Time: 0ms
  • Memory: 3708kb
  • [2024-08-02 22:12:03]
  • Submitted

answer

#include<bits/stdc++.h>

using namespace std;


typedef long long ll;
typedef long double ld;

#define endl "\n"
#define all(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
//#define int long long



// Don't Start typing till you complete the idea.


// Check these things for WA and before submitting
// 1. Did you clear all the global arrays
// 2. Did you checked your <= >= < > 
// 3. Did you take the input properly. Did you use break or return while taking input?
// 4. Did you divide by 0.
// 5. Check array , vector , etc size
// 6. in the while loop did you miss something that would cause infinite loop?
// 7. Did you save your dp?
// 8. Are you trying to use something after deleting it?
// 9. Did you read the problem statement wrong?
// 10. Did you check the constrains of the problem properly
// 11. Did you checked for smaller cases like 1 , 0 , etc
// 12. Is it something to with overflow?
// 13. Did you initialized all the variables properly?
// 14. Did you use the formulas correctly?

// STRESS TESTING !!!!!! STRESS TESTING !!!!!
// STRESS Testing Not working?
// Stress test for multiple cases? 
// Stress test for big inputs?
// Stress test for really small inputs?
// Even then if it doesn't work -> Did you wrote the wrong Brute force code


// Check these things if you are not generating ideas
// 1. Did you try thinking it in reverse?
// 2. Read the problem statement again
// 3. Check the constraints again
// 4. Try smaller cases in notebook and try to expand
// 5. Think about invariants
// 6. Think simpler ideas maybe?
// 7. Think brute force and try to get something out of it.
// 8. Maybe take a deep breath and take a break for few minutes and drink some water? :3 

void GG()
{
    int l , r;
    cin >> l >> r;
    if(r - l == 0){
        cout << l << endl;
    }
    else if(r - l == 1){
        cout << -1 << endl;
    }
    else {
        cout << r - 1 << endl;
    }
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int ttc=1;
	// cin>>ttc;
	//int cnt=0;
	while(ttc--)
	{
		//cout<<"Case "<<++cnt<<": ";
		GG();
	}
}

详细

Test #1:

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

input:

2 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

1 1

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

1 2

output:

-1

result:

ok 1 number(s): "-1"

Test #4:

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

input:

100 100

output:

100

result:

ok 1 number(s): "100"

Test #5:

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

input:

99 100

output:

-1

result:

ok 1 number(s): "-1"

Test #6:

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

input:

3 3

output:

3

result:

ok 1 number(s): "3"

Test #7:

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

input:

2 3

output:

-1

result:

ok 1 number(s): "-1"

Test #8:

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

input:

1 3

output:

2

result:

ok 1 number(s): "2"

Test #9:

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

input:

2 5

output:

4

result:

ok 1 number(s): "4"

Test #10:

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

input:

3 7

output:

6

result:

ok 1 number(s): "6"

Test #11:

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

input:

3 8

output:

7

result:

ok 1 number(s): "7"

Test #12:

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

input:

4 10

output:

9

result:

ok 1 number(s): "9"

Test #13:

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

input:

35 37

output:

36

result:

ok 1 number(s): "36"

Test #14:

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

input:

43 46

output:

45

result:

ok 1 number(s): "45"

Test #15:

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

input:

82 86

output:

85

result:

ok 1 number(s): "85"

Test #16:

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

input:

55 60

output:

59

result:

ok 1 number(s): "59"

Test #17:

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

input:

25 31

output:

30

result:

ok 1 number(s): "30"

Test #18:

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

input:

37 44

output:

43

result:

ok 1 number(s): "43"

Test #19:

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

input:

75 83

output:

82

result:

ok 1 number(s): "82"

Test #20:

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

input:

74 83

output:

82

result:

ok 1 number(s): "82"

Test #21:

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

input:

88 98

output:

97

result:

ok 1 number(s): "97"

Test #22:

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

input:

75 86

output:

85

result:

ok 1 number(s): "85"

Test #23:

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

input:

1 100

output:

99

result:

ok 1 number(s): "99"

Test #24:

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

input:

1 50

output:

49

result:

ok 1 number(s): "49"

Test #25:

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

input:

50 100

output:

99

result:

ok 1 number(s): "99"

Test #26:

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

input:

7 35

output:

34

result:

ok 1 number(s): "34"

Test #27:

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

input:

87 95

output:

94

result:

ok 1 number(s): "94"

Test #28:

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

input:

11 30

output:

29

result:

ok 1 number(s): "29"

Test #29:

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

input:

47 69

output:

68

result:

ok 1 number(s): "68"

Test #30:

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

input:

11 48

output:

47

result:

ok 1 number(s): "47"

Test #31:

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

input:

71 85

output:

84

result:

ok 1 number(s): "84"

Test #32:

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

input:

84 89

output:

88

result:

ok 1 number(s): "88"

Test #33:

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

input:

22 56

output:

55

result:

ok 1 number(s): "55"

Test #34:

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

input:

2 72

output:

71

result:

ok 1 number(s): "71"

Test #35:

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

input:

18 55

output:

54

result:

ok 1 number(s): "54"

Test #36:

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

input:

4 11

output:

10

result:

ok 1 number(s): "10"

Test #37:

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

input:

42 59

output:

58

result:

ok 1 number(s): "58"

Test #38:

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

input:

52 79

output:

78

result:

ok 1 number(s): "78"

Test #39:

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

input:

11 48

output:

47

result:

ok 1 number(s): "47"

Test #40:

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

input:

4 51

output:

50

result:

ok 1 number(s): "50"

Test #41:

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

input:

3 60

output:

59

result:

ok 1 number(s): "59"

Test #42:

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

input:

21 88

output:

87

result:

ok 1 number(s): "87"

Test #43:

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

input:

17 94

output:

93

result:

ok 1 number(s): "93"

Test #44:

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

input:

11 98

output:

97

result:

ok 1 number(s): "97"

Test #45:

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

input:

2 99

output:

98

result:

ok 1 number(s): "98"

Extra Test:

score: 0
Extra Test Passed