QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#292245 | #7642. Integer Half-Sum | bachbeo2007 | AC ✓ | 0ms | 3772kb | C++23 | 1.9kb | 2023-12-27 21:55:10 | 2023-12-27 21:55:10 |
Judging History
answer
// Judges with GCC >= 12 only needs Ofast
// #pragma GCC optimize("O3,no-stack-protector,fast-math,unroll-loops,tree-vectorize")
// MLE optimization
// #pragma GCC optimize("conserve-stack")
// Old judges
// #pragma GCC target("sse4.2,popcnt,lzcnt,abm,mmx,fma,bmi,bmi2")
// New judges. Test with assert(__builtin_cpu_supports("avx2"));
// #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
// Atcoder
// #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma")
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
- insert(x),erase(x)
- find_by_order(k): return iterator to the k-th smallest element
- order_of_key(x): the number of elements that are strictly smaller
*/
#include<bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
uniform_real_distribution<> pp(0.0,1.0);
#define int long long
#define ld long double
#define pii pair<int,int>
#define piii pair<int,pii>
#define mpp make_pair
#define fi first
#define se second
const int inf=1e18;
const int mod=998244353;
const int maxn=200005;
const int bl=650;
const int maxs=655;
const int maxm=200005;
const int maxq=1000005;
const int maxl=25;
const int maxa=1000000;
const int root=3;
int power(int a,int n){
int res=1;
while(n){
if(n&1) res=res*a%mod;
a=a*a%mod;n>>=1;
}
return res;
}
const int iroot=power(3,mod-2);
const int base=131;
void solve(){
int l,r;cin >> l >> r;
if((r-l)>=2) cout << r-1 << '\n';
else if(r-l==1) cout << -1 << '\n';
else cout << r << '\n';
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
int test=1;//cin >> test;
while(test--) solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3620kb
input:
2 4
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
1 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
1 2
output:
-1
result:
ok 1 number(s): "-1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
100 100
output:
100
result:
ok 1 number(s): "100"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
99 100
output:
-1
result:
ok 1 number(s): "-1"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
3 3
output:
3
result:
ok 1 number(s): "3"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
2 3
output:
-1
result:
ok 1 number(s): "-1"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1 3
output:
2
result:
ok 1 number(s): "2"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
2 5
output:
4
result:
ok 1 number(s): "4"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
3 7
output:
6
result:
ok 1 number(s): "6"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
3 8
output:
7
result:
ok 1 number(s): "7"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
4 10
output:
9
result:
ok 1 number(s): "9"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
35 37
output:
36
result:
ok 1 number(s): "36"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
43 46
output:
45
result:
ok 1 number(s): "45"
Test #15:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
82 86
output:
85
result:
ok 1 number(s): "85"
Test #16:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
55 60
output:
59
result:
ok 1 number(s): "59"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
25 31
output:
30
result:
ok 1 number(s): "30"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
37 44
output:
43
result:
ok 1 number(s): "43"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
75 83
output:
82
result:
ok 1 number(s): "82"
Test #20:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
74 83
output:
82
result:
ok 1 number(s): "82"
Test #21:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
88 98
output:
97
result:
ok 1 number(s): "97"
Test #22:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
75 86
output:
85
result:
ok 1 number(s): "85"
Test #23:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
1 100
output:
99
result:
ok 1 number(s): "99"
Test #24:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
1 50
output:
49
result:
ok 1 number(s): "49"
Test #25:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
50 100
output:
99
result:
ok 1 number(s): "99"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
7 35
output:
34
result:
ok 1 number(s): "34"
Test #27:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
87 95
output:
94
result:
ok 1 number(s): "94"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
11 30
output:
29
result:
ok 1 number(s): "29"
Test #29:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
47 69
output:
68
result:
ok 1 number(s): "68"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
11 48
output:
47
result:
ok 1 number(s): "47"
Test #31:
score: 0
Accepted
time: 0ms
memory: 3708kb
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: 3568kb
input:
22 56
output:
55
result:
ok 1 number(s): "55"
Test #34:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
2 72
output:
71
result:
ok 1 number(s): "71"
Test #35:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
18 55
output:
54
result:
ok 1 number(s): "54"
Test #36:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
4 11
output:
10
result:
ok 1 number(s): "10"
Test #37:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
42 59
output:
58
result:
ok 1 number(s): "58"
Test #38:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
52 79
output:
78
result:
ok 1 number(s): "78"
Test #39:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
11 48
output:
47
result:
ok 1 number(s): "47"
Test #40:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
4 51
output:
50
result:
ok 1 number(s): "50"
Test #41:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
3 60
output:
59
result:
ok 1 number(s): "59"
Test #42:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
21 88
output:
87
result:
ok 1 number(s): "87"
Test #43:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
17 94
output:
93
result:
ok 1 number(s): "93"
Test #44:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
11 98
output:
97
result:
ok 1 number(s): "97"
Test #45:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
2 99
output:
98
result:
ok 1 number(s): "98"
Extra Test:
score: 0
Extra Test Passed