QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#167060 | #7115. Can You Guess My Sequence? | ucup-team1716 | AC ✓ | 1ms | 3836kb | C++20 | 764b | 2023-09-07 00:45:31 | 2023-09-07 00:45:33 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
string s;
cin >> s;
if(s=="Alice")
{
int n;
cin >> n;
ll ans = 0;
for(int i=0; i<n; i++)
{
int x;
cin >> x;
ans += round(pow(2, x));
}
cout << ans << "\n";
}
else
{
int num;
cin >> num;
vector<int> a;
for(int i=0; i<20; i++)
{
if(num%2) a.pb(i);
num /= 2;
}
cout << a.size() << "\n";
for(int x: a) cout << x << " ";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3580kb
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: 3768kb
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: 3684kb
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: 3836kb
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: 3592kb
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: 3832kb
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: 3620kb
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