QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#185219#4184. Amusement Arcadergnerdplayer#WA 0ms3704kbC++20692b2023-09-21 19:13:282023-09-21 19:13:29

Judging History

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

  • [2023-09-21 19:13:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3704kb
  • [2023-09-21 19:13:28]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    
    auto solve = [&]() {
        auto check = [&](i64 x) {
            return x == (x & -x);
        };

        i64 n;
        cin >> n;

        if (check(n - 1)) {
            cout << (n + 1) / 2 << '\n';
            return;
        }

        for (int p = 1; p < 60; p++) {
            i64 t = 1LL << p;
            if (n - t - 1 > 0 && check(n - p - 1)) {
                cout << p + 1 << '\n';
                return;
            }
        }

        cout << "impossible\n";
    };

    solve();

    return 0;
}


詳細信息

Test #1:

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

input:

7

output:

3

result:

ok 

Test #2:

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

input:

15

output:

impossible

result:

ok 

Test #3:

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

input:

19

output:

3

result:

ok 

Test #4:

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

input:

2049

output:

1025

result:

ok 

Test #5:

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

input:

32769

output:

16385

result:

ok 

Test #6:

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

input:

536870913

output:

268435457

result:

ok 

Test #7:

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

input:

35184372088833

output:

17592186044417

result:

ok 

Test #8:

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

input:

2251799813685249

output:

1125899906842625

result:

ok 

Test #9:

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

input:

576460752303423489

output:

288230376151711745

result:

ok 

Test #10:

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

input:

1027

output:

3

result:

ok 

Test #11:

score: -100
Wrong Answer
time: 0ms
memory: 3644kb

input:

2081

output:

impossible

result:

wrong output format Expected integer, but "impossible" found