QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#54663#4184. Amusement ArcadeAs3b_team_f_masr#WA 2ms3712kbC++725b2022-10-10 02:51:172022-10-10 02:51:18

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 02:51:18]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3712kb
  • [2022-10-10 02:51:17]
  • 提交

answer

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

#define fi first
#define sc second

const ll mx=1e18;
int main()
{
	//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll x=1;
	map<ll,int>mp;
	vector<ll> v;
	while(x<=mx)
    {
        mp[x]++;
        v.push_back(x);
        x*=2;
        x+=1;
    }
    ll n;
    cin>>n;
    if(n==3)
    {
        cout<<1<<endl;
        return 0;
    }
    n-=3;
    for(auto y:v)
    {
        if(n>y&&mp[n-y])
        {
            cout<<y+2;
            return 0;
        }
    }
    cout<<"impossible";
	return 0;
}
/*5 4 6
1 5 3 2
1 2
1 3
1 5
2 4
4 5
3 5
1 3*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

7

output:

3

result:

ok 

Test #2:

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

input:

15

output:

impossible

result:

ok 

Test #3:

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

input:

19

output:

3

result:

ok 

Test #4:

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

input:

2049

output:

1025

result:

ok 

Test #5:

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

input:

32769

output:

16385

result:

ok 

Test #6:

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

input:

536870913

output:

268435457

result:

ok 

Test #7:

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

input:

35184372088833

output:

17592186044417

result:

ok 

Test #8:

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

input:

2251799813685249

output:

1125899906842625

result:

ok 

Test #9:

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

input:

576460752303423489

output:

288230376151711745

result:

ok 

Test #10:

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

input:

1027

output:

3

result:

ok 

Test #11:

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

input:

2081

output:

33

result:

ok 

Test #12:

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

input:

34393292801

output:

33554433

result:

ok 

Test #13:

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

input:

1

output:

impossible

result:

wrong output format Expected integer, but "impossible" found