QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#698952#7115. Can You Guess My Sequence?TheZoneAC ✓0ms3740kbC++202.5kb2024-11-01 23:18:292024-11-01 23:18:30

Judging History

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

  • [2024-11-01 23:18:30]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3740kb
  • [2024-11-01 23:18:29]
  • 提交

answer

#include <bits/stdc++.h>
#define taskname ""
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define i64 long long
#define pb push_back
#define ff first
#define ss second
#define isz(x) (int)x.size()
using namespace std;

const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
const i64 oo = 1e18;

string name;

void solve() {
    cin >> name;
    if (name == "Alice") {
        int n, res = 0; cin >> n;
        for (int i = 1; i <= n; ++i) {
            int val; cin >> val;
            res += 1 << val;
        }
        cout << res << endl;
    }
    else {
        int val; cin >> val;
        cout << __builtin_popcount(val) << "\n";
        for (int i = 0; i < 20; ++i) if (val >> i & 1) cout << i << " ";
        cout << endl;
    }
}

signed main() {

#ifndef CDuongg
    if(fopen(taskname".inp", "r"))
        assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout));
#else
    freopen("bai3.inp", "r", stdin);
    freopen("bai3.out", "w", stdout);
    auto start = chrono::high_resolution_clock::now();
#endif

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1; //cin >> t;
    while(t--) solve();

#ifdef CDuongg
   auto end = chrono::high_resolution_clock::now();
   cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '=';
   cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl;
   cout << "Check array size pls sir" << endl;
#endif

}
































































































































































































































































































































































































































































































































Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3692kb

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

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

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

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

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

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