CSES - HIIT Open 2024 - Results
Submission details
Task:Conspiracies everywhere
Sender:ä
Submission time:2024-11-16 12:59:43 +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
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#100.00 sdetails
#11ACCEPTED0.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:55:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long unsigned int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |         for (int j = 0; j < sol[i].size(); ++j){
      |                         ~~^~~~~~~~~~~~~~~

Code

#include <bits/stdc++.h>

// g++ -std=c++17 c.cpp -o c
using namespace std;

vector<vector<uint64_t>> sol;
int n;

bool hae(int level, uint64_t q, uint64_t lc){
    
    if (level > n){
            return true;
        }
    //cout << "oof " << level << " " << q << endl;
    if (sol[level-1].size() == 0){
        
        if(level == n && q > 0) {
            sol[level-1].push_back(q);
            return true;
        }
        else if (q == 0) {
            return false;
        }
        sol[level-1].push_back(q);
        bool ok = true;
        ok &= hae(level+1, q-q/2, 0);
        ok &= hae(level+1, q/2, 0);
        return ok;
    }
    else {
        uint64_t upper = sol[level-2].back();
        uint64_t left = sol[level-1].back();
        auto self = upper - left;
        if (self <= 0) {
            return false;
        }
        sol[level-1].push_back(self);
        bool ok = true;
        ok &= hae(level+1, q/2, 0);
        return ok;
    }
}

int main() {
    uint64_t q; cin >> n >> q;
    for (int i = 0; i < n; ++i) {
        sol.push_back(vector<uint64_t>());
    }
    bool ok = hae(1, q, 0);
    if (!ok) {
        cout << "The truth is out there" << endl;
        return 0;
    }
    for (int i = n-1; i < n; ++i) {
        for (int j = 0; j < sol[i].size(); ++j){
            cout << sol[i][j] << " ";
        }
    }
    cout << endl;
    return 0;
}

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

Test 5

Verdict:

input
60 1000000000000000000

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

user output
The truth is out there

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: ACCEPTED

input
60 500000000000000000

correct output
The truth is out there

user output
The truth is out there

Test 8

Verdict: ACCEPTED

input
5 1000000000

correct output
999999985 1 1 1 1

user output
62500000 62500000 62500000 625...

Test 9

Verdict: ACCEPTED

input
19 1000000000

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

user output
3815 3815 3814 3816 3813 3816 ...

Test 10

Verdict:

input
59 1000000000000000000

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

user output
The truth is out there

Test 11

Verdict: ACCEPTED

input
42 133713371337

correct output
The truth is out there

user output
The truth is out there

Test 12

Verdict:

input
42 1337133713371337

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

user output
609 608 608 608 608 609 605 61...

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
500000000000000000 50000000000...

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
2 1 1 1 1 1 1 1 1 1