# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
464428 | Quentolosse | Rack (eJOI19_rack) | C++14 | 102 ms | 102404 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main()
{
int nbEtages, nbCrochets, nbManteauxAPoser;
cin >> nbEtages >> nbManteauxAPoser;
vector<int> manteaux;
nbCrochets = pow (2, nbEtages);
manteaux.push_back (1);
manteaux.push_back((nbCrochets / 2) + 1);
int i = 1, debut = 1;
while (manteaux.size() < nbManteauxAPoser)
{
for (int i2 = 0; i2 < i; i2++)
{
manteaux.push_back(manteaux[debut + i2] - (nbCrochets / (i * 4)));
}
for (int i2 = 0; i2 < i; i2++)
{
manteaux.push_back(manteaux[debut + i2] + (nbCrochets / (i * 4)));
}
debut += i;
i = i * 2;
}
cout << manteaux[nbManteauxAPoser - 1];
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |