QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#155351 | #7115. Can You Guess My Sequence? | ucup-team1196# | AC ✓ | 1ms | 3796kb | C++14 | 2.4kb | 2023-09-01 16:04:06 | 2023-09-01 16:04:06 |
Judging History
answer
/*
_/ _/ _/ _/ _/ _/ _/_/_/_/_/ _/_/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/ _/_/
_/_/ _/_/_/_/_/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/_/ _/ _/
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n-1;i>=a;i--)
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define multi int _;cin>>_;while(_--)
#define debug(x) cerr << #x << " = " << (x) << endl;
#define int long long
#define pb push_back
#define eb emplace_back
ll gcd(ll a,ll b){ return b?gcd(b,a%b):a;}
mt19937 mrand(random_device{}());
int rnd(int x){ return mrand() % x; }
void test() {cerr << "\n";}
template<typename T, typename... Args>
void test(T x, Args... args) {cerr << x << " ";test(args...);}
// const ll MOD = 998244353;
const ll MOD = 1e9+7;
int ksm(int x,int y){int ans=1;x%=MOD;while(y){if(y&1)ans=ans*x%MOD;x=x*x%MOD,y/=2;}return ans;}
const ll P1 = 999971, base1 = 101;
const ll P2 = 999973, base2 = 103;
const ll N = 200005;
//head
signed main()
{
#ifdef localfreopen
// freopen("1.in","r",stdin);
#endif
fastio
string s;
cin >> s;
if(s == "Alice")
{
int n;
cin >> n;
vector<int> is(25);
for(int i = 1 ; i <= n ; i++ )
{
int x;
cin >> x;
is[x] = 1;
}
int ans = 0;
for(int i = 0 ; i <= 20 ; i++ )
{
ans = ans * 2 + is[i];
}
cout << ans << "\n";
}else{
int n;
cin >> n;
vector<int> q;
for(int i = 20 ; i >= 0 ; i-- )
{
if(n % 2) q.push_back(i);
n /= 2;
}
sort(q.begin(), q.end());
cout << q.size() << "\n";
for(auto x : q)
{
cout << x << " ";
}
cout << "\n";
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3592kb
First Run Input
Alice 6 2 3 5 8 10 15
First Run Output
431136
Second Run Input
Bob 431136
Second Run Output
6 2 3 5 8 10 15
result:
ok correct
Test #2:
score: 100
Accepted
time: 1ms
memory: 3532kb
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: 3580kb
First Run Input
Alice 1 0
First Run Output
1048576
Second Run Input
Bob 1048576
Second Run Output
1 0
result:
ok correct
Test #4:
score: 100
Accepted
time: 1ms
memory: 3796kb
First Run Input
Alice 2 0 15
First Run Output
1048608
Second Run Input
Bob 1048608
Second Run Output
2 0 15
result:
ok correct
Test #5:
score: 100
Accepted
time: 1ms
memory: 3560kb
First Run Input
Alice 10 1 3 5 7 9 11 12 14 15 16
First Run Output
699248
Second Run Input
Bob 699248
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: 3796kb
First Run Input
Alice 3 16 17 18
First Run Output
28
Second Run Input
Bob 28
Second Run Output
3 16 17 18
result:
ok correct
Test #7:
score: 100
Accepted
time: 1ms
memory: 3752kb
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
2097138
Second Run Input
Bob 2097138
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