QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#72107#4184. Amusement Arcadericky0129WA 2ms3520kbC++14837b2023-01-14 01:14:042023-01-14 01:14:05

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-14 01:14:05]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3520kb
  • [2023-01-14 01:14:04]
  • 提交

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;
    if(x<=3){
        cout<<1<<endl;
        return 0;
    }
    ll d = (x+1)/2;
    ll dist;
    if(d%2==1){
        dist = x-1;
    }
    else{
        dist = x-3;
    }
    int bits =0;
    FOR(i,61){
        if(dist&(1LL<<i)) bits++;
    }
    if(bits!=1) cout<<"impossible\n";
    else if(d%2==1) cout<<1<<endl;
    else cout<<3<<endl;
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

7

output:

3

result:

ok 

Test #2:

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

input:

15

output:

impossible

result:

ok 

Test #3:

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

input:

19

output:

3

result:

ok 

Test #4:

score: 0
Accepted
time: 2ms
memory: 3232kb

input:

2049

output:

1

result:

ok 

Test #5:

score: 0
Accepted
time: 2ms
memory: 3484kb

input:

32769

output:

1

result:

ok 

Test #6:

score: 0
Accepted
time: 2ms
memory: 3332kb

input:

536870913

output:

1

result:

ok 

Test #7:

score: 0
Accepted
time: 2ms
memory: 3344kb

input:

35184372088833

output:

1

result:

ok 

Test #8:

score: 0
Accepted
time: 2ms
memory: 3292kb

input:

2251799813685249

output:

1

result:

ok 

Test #9:

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

input:

576460752303423489

output:

1

result:

ok 

Test #10:

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

input:

1027

output:

3

result:

ok 

Test #11:

score: -100
Wrong Answer
time: 2ms
memory: 3468kb

input:

2081

output:

impossible

result:

wrong output format Expected integer, but "impossible" found