QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#321723 | #7115. Can You Guess My Sequence? | Unknown1508 | AC ✓ | 0ms | 3740kb | C++20 | 768b | 2024-02-05 10:50:30 | 2024-02-05 10:50:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void main_program();
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0);
main_program();
}
string player;
namespace alice {
int n;
void solve(){
cin >> n;
int num = 0;
for (int i = 0; i < n; i++){
int x; cin >> x;
num |= (1 << x);
}
cout << num << "\n";
}
}
namespace bob {
vector<int> v;
void solve(){
int num; cin >> num;
for (int i = 0; i < 20; i++){
if ((num >> i) & 1) v.push_back(i);
}
cout << v.size() << "\n";
for (int i = 0; i < (int)v.size(); i++){
cout << v[i] << " \n"[i == (int)v.size() - 1];
}
}
}
void main_program(){
cin >> player;
if (player == "Alice") alice::solve();
else bob::solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3740kb
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: 0ms
memory: 3732kb
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: 0ms
memory: 3640kb
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: 0ms
memory: 3612kb
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: 0ms
memory: 3692kb
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: 0ms
memory: 3684kb
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: 0ms
memory: 3736kb
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