QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#154022 | #7115. Can You Guess My Sequence? | ucup-team1087# | AC ✓ | 1ms | 3768kb | C++14 | 838b | 2023-08-31 12:41:04 | 2023-08-31 12:41:09 |
Judging History
answer
//
// main.cpp
// Can You Guess My Sequence
//
// Created by SkyWave Sun on 2023/8/31.
//
#include <iostream>
#include <bitset>
#include <vector>
using namespace std;
#define N (int)31
int a[N];
int main(int argc, const char * argv[]) {
string str;
cin >> str;
if (str == "Alice") {
int n;
scanf("%d", &n);
int num = 0;
for (int i = 1; i <= n; ++i) {
scanf("%d", &a[i]);
num |= 1 << (a[i] + 1);
}
printf("%d\n", num);
} else {
int n;
scanf("%d", &n);
bitset<N> mark(n);
printf("%zu\n", mark.count());
for (int i = 1; i <= 30; ++i) {
if (mark[i]) {
printf("%d ", i - 1);
}
}
putchar('\n');
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3668kb
First Run Input
Alice 6 2 3 5 8 10 15
First Run Output
68184
Second Run Input
Bob 68184
Second Run Output
6 2 3 5 8 10 15
result:
ok correct
Test #2:
score: 100
Accepted
time: 1ms
memory: 3648kb
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
2097150
Second Run Input
Bob 2097150
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: 3652kb
First Run Input
Alice 1 0
First Run Output
2
Second Run Input
Bob 2
Second Run Output
1 0
result:
ok correct
Test #4:
score: 100
Accepted
time: 1ms
memory: 3648kb
First Run Input
Alice 2 0 15
First Run Output
65538
Second Run Input
Bob 65538
Second Run Output
2 0 15
result:
ok correct
Test #5:
score: 100
Accepted
time: 1ms
memory: 3768kb
First Run Input
Alice 10 1 3 5 7 9 11 12 14 15 16
First Run Output
243028
Second Run Input
Bob 243028
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: 3644kb
First Run Input
Alice 3 16 17 18
First Run Output
917504
Second Run Input
Bob 917504
Second Run Output
3 16 17 18
result:
ok correct
Test #7:
score: 100
Accepted
time: 1ms
memory: 3668kb
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
1310718
Second Run Input
Bob 1310718
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