QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#162699 | #7115. Can You Guess My Sequence? | ucup-team1266 | AC ✓ | 1ms | 3880kb | C++20 | 915b | 2023-09-03 15:56:04 | 2023-09-03 15:56:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define yes cout << "YES\n"
#define no cout << "NO\n"
const ll LNF = 9223372036854775807;
const int MAX = 1e5 + 10, INF = 0x7fffffff, mod = 1e9 + 7, mod2 = 998244353;
ll n, m, t;
string s;
void alc(){
cin >> n;
ll res = 0;
for (int i = 0; i < n; ++ i){
cin >> t;
res |= (1 << t);
}
cout << res << endl;
}
void bob(){
cin >> n;
vector<int> ans;
for (int i = 0; i < 22; ++ i){
if (n & (1 << i)) ans.push_back(i);
}
cout << ans.size() << endl;
for (auto i: ans) cout << i << ' ';
cout << endl;
}
void solve(){
cin >> s;
if (s == "Alice") alc();
else bob();
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//cout << fixed << setprecision(12);
//while (cin >> n)
//int _;cin>>_;while(_--)
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3872kb
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: 3636kb
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: 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: 1ms
memory: 3880kb
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: 3604kb
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: 3628kb
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: 3876kb
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