QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#234416#4184. Amusement ArcadeFyind#TL 0ms3824kbC++17609b2023-11-01 17:00:032023-11-01 17:00:04

Judging History

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

  • [2023-11-01 17:00:04]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3824kb
  • [2023-11-01 17:00:03]
  • 提交

answer

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

int main() {
    ll x;
    cin >> x;
    if (x == 1) {
        cout << "1\n";
        return 0;
    }
    x = (x + 1) / 2 + 1;
    vector<int> f;
    set<ll> s;
    f.push_back(1);
    f.push_back(2);
    s.insert(1);
    s.insert(2);
    while (*f.rbegin() * 2 - 1 <= x)
        f.push_back(*f.rbegin() * 2 - 1), s.insert(*f.rbegin());
    for (ll xx : f)
        if (s.find(x - xx) != s.end()) {
            cout << xx * 2 - 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: 3616kb

input:

7

output:

3

result:

ok 

Test #2:

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

input:

15

output:

impossible

result:

ok 

Test #3:

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

input:

19

output:

3

result:

ok 

Test #4:

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

input:

2049

output:

1

result:

ok 

Test #5:

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

input:

32769

output:

1

result:

ok 

Test #6:

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

input:

536870913

output:

1

result:

ok 

Test #7:

score: -100
Time Limit Exceeded

input:

35184372088833

output:


result: