CSES - HIIT Open 2024 - Results
Submission details
Task:Conspiracies everywhere
Sender:undefined reference to 'Päivölä'
Submission time:2024-11-16 13:08:07 +0200
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#50.00 sdetails
#6ACCEPTED0.00 sdetails
#70.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#100.00 sdetails
#110.00 sdetails
#120.00 sdetails
#13ACCEPTED0.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#16ACCEPTED0.00 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:10:26: warning: comparison of integer expressions of different signedness: 'int' and 'll' {aka 'long long unsigned int'} [-Wsign-compare]
   10 |     if ((1 << (ll)(n-1)) > q) {
      |         ~~~~~~~~~~~~~~~~~^~~
input/code.cpp:23:30: warning: 'msb' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |         ll a = (1 << (ll)(msb-n+1));
      |                           ~~~^~

Code

#include <bits/stdc++.h>

using namespace std;
typedef unsigned long long ll;

int main() {
    int n;
    ll q;
    cin >> n >> q;
    if ((1 << (ll)(n-1)) > q) {
        cout << "The truth is out there" << "\n";
    } else {
        int msb;
        for (int i = 0; i < 64; i++) {
            if (q >> i == 1) {
                msb = i;
                break;
            }
        }
        ll diff = q - (1 << (ll)msb);
        //cout << diff;
        //cout << n << msb;
        ll a = (1 << (ll)(msb-n+1));
        for (int i = 0; i < n - 1; i++) {
            cout << a << " ";
        }
        cout << a + diff << endl;
    }
}

Test details

Test 1

Verdict: ACCEPTED

input
3 8

correct output
5 1 1

user output
2 2 2

Test 2

Verdict: ACCEPTED

input
2 1

correct output
The truth is out there

user output
The truth is out there

Test 3

Verdict: ACCEPTED

input
1 1000000000000000000

correct output
1000000000000000000

user output
1000000000000000000

Test 4

Verdict: ACCEPTED

input
1 1

correct output
1

user output
1

Test 5

Verdict:

input
60 1000000000000000000

correct output
423539247696576513 1 1 1 1 1 1...

user output
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

Test 6

Verdict: ACCEPTED

input
10 512

correct output
1 1 1 1 1 1 1 1 1 1

user output
1 1 1 1 1 1 1 1 1 1

Test 7

Verdict:

input
60 500000000000000000

correct output
The truth is out there

user output
18446744071562067968 184467440...

Test 8

Verdict: ACCEPTED

input
5 1000000000

correct output
999999985 1 1 1 1

user output
33554432 33554432 33554432 335...

Test 9

Verdict: ACCEPTED

input
19 1000000000

correct output
999737857 1 1 1 1 1 1 1 1 1 1 ...

user output
2048 2048 2048 2048 2048 2048 ...

Test 10

Verdict:

input
59 1000000000000000000

correct output
711769623848288257 1 1 1 1 1 1...

user output
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

Test 11

Verdict:

input
42 133713371337

correct output
The truth is out there

user output
134217728 134217728 134217728 ...

Test 12

Verdict:

input
42 1337133713371337

correct output
1334934690115786 1 1 1 1 1 1 1...

user output
512 512 512 512 512 512 512 51...

Test 13

Verdict: ACCEPTED

input
2 2

correct output
1 1

user output
1 1

Test 14

Verdict: ACCEPTED

input
2 1000000000000000000

correct output
999999999999999999 1

user output
67108864 999999999932891136

Test 15

Verdict: ACCEPTED

input
10 511

correct output
The truth is out there

user output
The truth is out there

Test 16

Verdict: ACCEPTED

input
10 513

correct output
2 1 1 1 1 1 1 1 1 1

user output
1 1 1 1 1 1 1 1 1 2