QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#154026#7115. Can You Guess My Sequence?ucup-team198#AC ✓1ms3780kbC++231.0kb2023-08-31 12:42:012023-08-31 12:42:02

Judging History

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

  • [2023-08-31 12:42:02]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3780kb
  • [2023-08-31 12:42:01]
  • 提交

answer

#include<iostream>
#include<cmath>
#include<cstring>
#include<cassert>
#include<string>
#include<queue>
#include<deque>
#include<stack>
#include<algorithm>
#include<unordered_map>
#include<map>
#include<vector>
#include<set>
#include<unordered_set>
#include<bitset>
#include<climits>
#include<numeric>
#include<functional>
#include<iomanip>
#ifdef YJL
#include<debug.h>
#else
#define debug(args...)0
#define debug_n(a,n)0
#endif
#define ALL(a) a.begin(),a.end()
using namespace std;
using ll=long long;

constexpr int N = 2e5 + 10;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    string ty;
    cin>>ty;
    if(ty=="Alice") {
        int n,ans=0;
        cin>>n;
        for(int i=0; i<n; ++i) {
            int x;
            cin>>x;
            ans|=1<<x;
        }
        cout<<ans<<endl;
    }else {
        int x;
        cin>>x;
        cout<<__builtin_popcount(x)<<endl;
        for(int i=0; i<20; ++i)
            if(x>>i&1)
                cout<<i<<' ';
    }
    return 0;
}
/*




*/

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3492kb

First Run Input

Alice
6
2 3 5 8 10 15

First Run Output

34092

Second Run Input

Bob
34092

Second Run Output

6
2 3 5 8 10 15 

result:

ok correct

Test #2:

score: 100
Accepted
time: 1ms
memory: 3780kb

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

1048575

Second Run Input

Bob
1048575

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: 1ms
memory: 3776kb

First Run Input

Alice
1
0

First Run Output

1

Second Run Input

Bob
1

Second Run Output

1
0 

result:

ok correct

Test #4:

score: 100
Accepted
time: 1ms
memory: 3524kb

First Run Input

Alice
2
0 15

First Run Output

32769

Second Run Input

Bob
32769

Second Run Output

2
0 15 

result:

ok correct

Test #5:

score: 100
Accepted
time: 1ms
memory: 3748kb

First Run Input

Alice
10
1 3 5 7 9 11 12 14 15 16

First Run Output

121514

Second Run Input

Bob
121514

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: 3584kb

First Run Input

Alice
3
16 17 18

First Run Output

458752

Second Run Input

Bob
458752

Second Run Output

3
16 17 18 

result:

ok correct

Test #7:

score: 100
Accepted
time: 1ms
memory: 3608kb

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

655359

Second Run Input

Bob
655359

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