QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#426900 | #4184. Amusement Arcade | rania__# | WA | 1ms | 3872kb | C++14 | 951b | 2024-06-01 00:12:48 | 2024-06-01 00:12:48 |
Judging History
answer
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef int in;
#define int long long
#define double long double
#define f first
#define s second
#define pb push_back
#define pp push
#define ceill(x,y) ((x/y)+(x%y!=0)*(x/abs(x)*y/abs(y)<0?0:1))
#define floorr(x,y) ((x/y)+(x%y!=0)*(x/abs(x)*y/abs(y)<0?-1:0))
#define YN(x) cout<<(x?"YES\n":"NO\n");
#define Yn(x) cout<<(x?"Yes\n":"No\n");
#define yn(x) cout<<(x?"yes\n":"no\n");
const int MAAX=1e18;
const int MOD=1e9+7;
const int MAX=1e9;
in main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int tc=1;
// cin>>tc;
while(tc--){
int n;
cin>>n;
if(__builtin_popcountll(n-1)==1){
cout<<"1\n";
return 0;
}
for(int i=0;(1ll<<i)<=n;i++){
if(__builtin_popcountll(n-(1ll<<i)-1)==1){
cout<<(1ll<<i)+1<<"\n";
return 0;
}
}
cout<<"impossible\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3872kb
input:
7
output:
3
result:
ok
Test #2:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
15
output:
impossible
result:
ok
Test #3:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
19
output:
3
result:
ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
2049
output:
1
result:
ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
32769
output:
1
result:
ok
Test #6:
score: 0
Accepted
time: 1ms
memory: 3612kb
input:
536870913
output:
1
result:
ok
Test #7:
score: 0
Accepted
time: 1ms
memory: 3836kb
input:
35184372088833
output:
1
result:
ok
Test #8:
score: 0
Accepted
time: 1ms
memory: 3636kb
input:
2251799813685249
output:
1
result:
ok
Test #9:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
576460752303423489
output:
1
result:
ok
Test #10:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
1027
output:
3
result:
ok
Test #11:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
2081
output:
33
result:
ok
Test #12:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
34393292801
output:
33554433
result:
ok
Test #13:
score: -100
Wrong Answer
time: 0ms
memory: 3636kb
input:
1
output:
impossible
result:
wrong output format Expected integer, but "impossible" found