QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#72111 | #4184. Amusement Arcade | ricky0129 | AC ✓ | 3ms | 3532kb | C++14 | 747b | 2023-01-14 01:38:25 | 2023-01-14 01:38:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define FOR(i,n) for(int i=0;i<n;i++)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define f first
#define s second
const int MOD = (int)1e9+7;
int main()
{
ll x;
cin>>x;
x--;
int bits =0;
int first = -1;
FOR(j,61){
if(x&(1LL<<j)){
if(!bits) first = j;
bits++;
}
}
if(bits>2) cout<<"impossible\n";
else if(bits<=1) cout<<"1\n";
else cout<<(1LL<<first)+1<<endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3516kb
input:
7
output:
3
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3332kb
input:
15
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 3376kb
input:
19
output:
3
result:
ok
Test #4:
score: 0
Accepted
time: 2ms
memory: 3296kb
input:
2049
output:
1
result:
ok
Test #5:
score: 0
Accepted
time: 2ms
memory: 3300kb
input:
32769
output:
1
result:
ok
Test #6:
score: 0
Accepted
time: 0ms
memory: 3408kb
input:
536870913
output:
1
result:
ok
Test #7:
score: 0
Accepted
time: 2ms
memory: 3332kb
input:
35184372088833
output:
1
result:
ok
Test #8:
score: 0
Accepted
time: 1ms
memory: 3296kb
input:
2251799813685249
output:
1
result:
ok
Test #9:
score: 0
Accepted
time: 2ms
memory: 3532kb
input:
576460752303423489
output:
1
result:
ok
Test #10:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
1027
output:
3
result:
ok
Test #11:
score: 0
Accepted
time: 2ms
memory: 3348kb
input:
2081
output:
33
result:
ok
Test #12:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
34393292801
output:
33554433
result:
ok
Test #13:
score: 0
Accepted
time: 2ms
memory: 3288kb
input:
1
output:
1
result:
ok
Test #14:
score: 0
Accepted
time: 2ms
memory: 3348kb
input:
281543696187393
output:
68719476737
result:
ok
Test #15:
score: 0
Accepted
time: 2ms
memory: 3448kb
input:
576460752303423491
output:
3
result:
ok
Test #16:
score: 0
Accepted
time: 1ms
memory: 3228kb
input:
576460752336977921
output:
33554433
result:
ok
Test #17:
score: 0
Accepted
time: 2ms
memory: 3408kb
input:
576461851815051265
output:
1099511627777
result:
ok
Test #18:
score: 0
Accepted
time: 2ms
memory: 3292kb
input:
864691128455135233
output:
288230376151711745
result:
ok
Test #19:
score: 0
Accepted
time: 2ms
memory: 3232kb
input:
635
output:
impossible
result:
ok
Test #20:
score: 0
Accepted
time: 2ms
memory: 3488kb
input:
4537995
output:
impossible
result:
ok
Test #21:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
4795018843
output:
impossible
result:
ok
Test #22:
score: 0
Accepted
time: 0ms
memory: 3472kb
input:
5268828738869
output:
impossible
result:
ok
Test #23:
score: 0
Accepted
time: 3ms
memory: 3468kb
input:
3859135424551273
output:
impossible
result:
ok
Test #24:
score: 0
Accepted
time: 2ms
memory: 3232kb
input:
3
output:
1
result:
ok
Test #25:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
63913510461995523
output:
impossible
result:
ok
Test #26:
score: 0
Accepted
time: 1ms
memory: 3388kb
input:
341683697045680425
output:
impossible
result:
ok
Test #27:
score: 0
Accepted
time: 2ms
memory: 3296kb
input:
999999999999999999
output:
impossible
result:
ok
Test #28:
score: 0
Accepted
time: 2ms
memory: 3332kb
input:
5
output:
1
result:
ok
Test #29:
score: 0
Accepted
time: 2ms
memory: 3484kb
input:
9
output:
1
result:
ok
Test #30:
score: 0
Accepted
time: 2ms
memory: 3480kb
input:
11
output:
3
result:
ok
Test #31:
score: 0
Accepted
time: 0ms
memory: 3288kb
input:
13
output:
5
result:
ok
Test #32:
score: 0
Accepted
time: 2ms
memory: 3412kb
input:
17
output:
1
result:
ok