Submission #1195892

#TimeUsernameProblemLanguageResultExecution timeMemory
1195892raphaelpA Light Inconvenience (CEOI23_light)C++20
0 / 100
127 ms408 KiB
#include <bits/stdc++.h>
#include "light.h"
using namespace std;

void prepare() {}
long long tot = 1;

pair<long long, vector<long long>> join(long long x)
{
    pair<long long, vector<long long>> ans;
    ans.first = x;
    tot += x;
    long long pos = 1;
    long long tot2 = tot;
    while (tot2 > 1)
    {
        ans.second.push_back(pos);
        pos += tot2 / 2;
        tot2 = (tot2 + 1) / 2;
    }
    ans.second.push_back(pos);
    return ans;
}
pair<long long, vector<long long>> leave(long long x)
{
    pair<long long, vector<long long>> ans;
    ans.first = x;
    tot -= x;
    long long pos = 1;
    long long tot2 = tot;
    while (tot2 > 1)
    {
        ans.second.push_back(pos);
        pos += tot2 / 2;
        tot2 = (tot2 + 1) / 2;
    }
    ans.second.push_back(pos);
    return ans;
}
/*long long main()
{
    long long N;
    cin >> N;
    for (long long i = 0; i < N; i++)
    {
        long long x;
        cin >> x;
        pair<long long, vector<long long>> y;
        if (x > 0)
            y = join(x);
        else
            y = leave(-x);
        cout << y.first << '\n';
        for (long long j = 0; j < y.second.size(); j++)
            cout << y.second[j] << ' ';
        cout << endl;
    }
}*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...