QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#54682#4184. Amusement ArcadeSa3tElSefr#WA 2ms3740kbC++1.3kb2022-10-10 03:54:352022-10-10 03:54:37

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-10 03:54:37]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3740kb
  • [2022-10-10 03:54:35]
  • 提交

answer

/// tban lecodes el bosta2
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;


#define pb push_back
#define F first
#define S second
#define f(i, a, b)  for(int i = a; i < b; i++)
#define all(a)  a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x,y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll

using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;
const int N = 2e5+5, LG = 18, MOD = 1e9+7;
const long double PI = acos(-1);
const long double EPS = 1e-7;

const string TARGET = "WALDO";

bool check(ll x) {return x & (x-1);}

void doWork() {

    ll n;
    cin >> n;
    if(n==1){
        cout<<"1\n";
        return;
    }

    for(int p = 1; p <= n; p *= 2) {
        if(!check(n-p-1)) {
            cout << p + 1 << '\n';
            return;
        }
    }

    cout << "impossible\n";


}
int32_t main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif // ONLINE_JUDGE

    int t = 1;
//    cin >> t;
    while (t--) {
        doWork();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3740kb

input:

7

output:

3

result:

ok 

Test #2:

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

input:

15

output:

impossible

result:

ok 

Test #3:

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

input:

19

output:

3

result:

ok 

Test #4:

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

input:

2049

output:

1025

result:

ok 

Test #5:

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

input:

32769

output:

16385

result:

ok 

Test #6:

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

input:

536870913

output:

268435457

result:

ok 

Test #7:

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

input:

35184372088833

output:

17592186044417

result:

ok 

Test #8:

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

input:

2251799813685249

output:

1125899906842625

result:

ok 

Test #9:

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

input:

576460752303423489

output:

288230376151711745

result:

ok 

Test #10:

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

input:

1027

output:

3

result:

ok 

Test #11:

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

input:

2081

output:

33

result:

ok 

Test #12:

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

input:

34393292801

output:

33554433

result:

ok 

Test #13:

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

input:

1

output:

1

result:

ok 

Test #14:

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

input:

281543696187393

output:

68719476737

result:

ok 

Test #15:

score: 0
Accepted
time: 1ms
memory: 3740kb

input:

576460752303423491

output:

3

result:

ok 

Test #16:

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

input:

576460752336977921

output:

33554433

result:

ok 

Test #17:

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

input:

576461851815051265

output:

1099511627777

result:

ok 

Test #18:

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

input:

864691128455135233

output:

288230376151711745

result:

ok 

Test #19:

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

input:

635

output:

impossible

result:

ok 

Test #20:

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

input:

4537995

output:

impossible

result:

ok 

Test #21:

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

input:

4795018843

output:

impossible

result:

ok 

Test #22:

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

input:

5268828738869

output:

impossible

result:

ok 

Test #23:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

3859135424551273

output:

impossible

result:

ok 

Test #24:

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

input:

3

output:

2

result:

wrong answer WA: host sits at an arcade labeled with an even number