QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#155405#7115. Can You Guess My Sequence?ucup-team1001AC ✓1ms3712kbC++231.3kb2023-09-01 16:32:382023-09-01 16:32:39

Judging History

你现在查看的是最新测评结果

  • [2023-09-01 16:32:39]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3712kb
  • [2023-09-01 16:32:38]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define LL __int128
#define rep(i,l,r) for(ll i = l; l <= r ? i <= r : i >= r;l <= r ? ++i : --i)
#define irep(i,l,r) for(ll i = l; i <= r; ++i)
#define drep(i,r,l) for(ll i = r; i >= l; --i)
#define abs(x) (x > 0 ? x : -x)
#define ceil(pp,qq) ((pp>0)^(qq>0)?-abs(pp)/abs(qq):pp%qq?pp/qq+1:pp/qq)
#define floor(pp,qq) ((pp>0)^(qq>0)?-ceil(abs(pp),abs(qq)):pp/qq)
using namespace std;

inline ll read(){
	ll s=0; bool fl = 0;
	char chcc=getchar();
	while(chcc<'0'||chcc>'9'){if(chcc == '-')fl = 1;chcc = getchar();}
	while(chcc>='0'&&chcc<='9') s=(s<<3)+(s<<1)+(chcc^48),chcc=getchar();
	return fl?-s:s;
}
inline char rc(){
	char readch = getchar();
	while(!('0'<= readch && readch <= '9' || 'A' <= readch && readch <= 'Z' || 'a' <= readch && readch <= 'z'))readch = getchar();
	return readch;
}

const int N = 500999;
const int mod = 1000000007;
const int itinf = 1000000000;
const long long llinf = 100000000000000000;

int main(){
	string s;
	cin >> s;
	if(s == "Alice"){
		int n = read(), ans = 0;
		irep(i,1,n)ans += (1 << (read()));
		printf("%d", itinf - ans);
	}
	else {
		int x = itinf - read();
		printf("%d\n",__popcount(x));
		irep(i,0,30){
			if(x & (1 << i))printf("%d ",i);
		}
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3648kb

First Run Input

Alice
6
2 3 5 8 10 15

First Run Output

999965908

Second Run Input

Bob
999965908

Second Run Output

6
2 3 5 8 10 15 

result:

ok correct

Test #2:

score: 100
Accepted
time: 1ms
memory: 3660kb

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

998951425

Second Run Input

Bob
998951425

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: 3572kb

First Run Input

Alice
1
0

First Run Output

999999999

Second Run Input

Bob
999999999

Second Run Output

1
0 

result:

ok correct

Test #4:

score: 100
Accepted
time: 1ms
memory: 3588kb

First Run Input

Alice
2
0 15

First Run Output

999967231

Second Run Input

Bob
999967231

Second Run Output

2
0 15 

result:

ok correct

Test #5:

score: 100
Accepted
time: 1ms
memory: 3712kb

First Run Input

Alice
10
1 3 5 7 9 11 12 14 15 16

First Run Output

999878486

Second Run Input

Bob
999878486

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: 3592kb

First Run Input

Alice
3
16 17 18

First Run Output

999541248

Second Run Input

Bob
999541248

Second Run Output

3
16 17 18 

result:

ok correct

Test #7:

score: 100
Accepted
time: 1ms
memory: 3648kb

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

999344641

Second Run Input

Bob
999344641

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