QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#155713 | #7115. Can You Guess My Sequence? | ucup-team1338 | AC ✓ | 1ms | 3764kb | C++17 | 848b | 2023-09-02 01:36:16 | 2023-09-02 01:36:17 |
Judging History
answer
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const LL N=29;
LL n,m=20,x;
LL a[N];
char user[9];
template<typename T>
inline void read(T &x)
{
x=0;T w=1;char c=getchar();
while(!isdigit(c)){if(c=='-')w=-1; c=getchar();}
while(isdigit(c)){x=x*10+(c^'0'); c=getchar();}
if(w==-1) x=-x;
}
template<typename T,typename... Args>
inline void read(T &x,Args &...args)
{
read(x),read(args...);
}
void solve1()
{
read(n);
x=0;
for(LL i=1;i<=n;++i)
{
read(a[i]);
x|=1<<a[i];
}
printf("%lld",x-1);
}
void solve2()
{
read(x);
++x;
vector<LL> ans;
for(LL k=0;k<20;++k)
{
if((x>>k)&1) ans.push_back(k);
}
printf("%llu\n",ans.size());
for(auto v:ans)
printf("%lld ",v);
}
int main()
{
scanf("%s",user);
if(user[0]=='A')
solve1();
else
solve2();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3628kb
First Run Input
Alice 6 2 3 5 8 10 15
First Run Output
34091
Second Run Input
Bob 34091
Second Run Output
6 2 3 5 8 10 15
result:
ok correct
Test #2:
score: 100
Accepted
time: 1ms
memory: 3656kb
First Run Input
Alice 20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
First Run Output
1048574
Second Run Input
Bob 1048574
Second Run Output
20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
result:
ok correct
Test #3:
score: 100
Accepted
time: 0ms
memory: 3764kb
First Run Input
Alice 1 0
First Run Output
0
Second Run Input
Bob 0
Second Run Output
1 0
result:
ok correct
Test #4:
score: 100
Accepted
time: 1ms
memory: 3764kb
First Run Input
Alice 2 0 15
First Run Output
32768
Second Run Input
Bob 32768
Second Run Output
2 0 15
result:
ok correct
Test #5:
score: 100
Accepted
time: 0ms
memory: 3636kb
First Run Input
Alice 10 1 3 5 7 9 11 12 14 15 16
First Run Output
121513
Second Run Input
Bob 121513
Second Run Output
10 1 3 5 7 9 11 12 14 15 16
result:
ok correct
Test #6:
score: 100
Accepted
time: 1ms
memory: 3620kb
First Run Input
Alice 3 16 17 18
First Run Output
458751
Second Run Input
Bob 458751
Second Run Output
3 16 17 18
result:
ok correct
Test #7:
score: 100
Accepted
time: 1ms
memory: 3652kb
First Run Input
Alice 18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19
First Run Output
655358
Second Run Input
Bob 655358
Second Run Output
18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19
result:
ok correct