QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#234416 | #4184. Amusement Arcade | Fyind# | TL | 0ms | 3824kb | C++17 | 609b | 2023-11-01 17:00:03 | 2023-11-01 17:00:04 |
Judging History
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;
}
詳細信息
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