# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
585503 | LIF | Mechanical Doll (IOI18_doll) | C++14 | 1 ms | 340 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 "doll.h"
void create_circuit(int M, std::vector<int> A) {
int N = A.size();
std::vector<int> x,y;
std::vector<int> c;
int n = N;
c[0] = 1;
std::vector<int> node[100005];
for(int i=1; i<=n-1; i++)
{
int qq = A[i];
node[qq].push_back(A[i+1]);
}
int xx = A[n];
node[xx].push_back(0);
int fir = 1 ;//that means the first case is 1 ,and we can create our plan.
for(int i=1;i<=M;i++) //that means we deal with the sensor.
{
int sum = node[i].size();
int num = 0;
if(sum == 1)
{
int kx = node[i][0];
c.push_back(kx);
}
else
{
sum+=1;
int dd=1;
int flag = 0;
for(int j=1;j<=100;j++)
{
dd*=2;
num = j; //that means we should create how many hiearachy
if(dd >= sum)
{
flag = 1;
break;
}
}
}
}
answer(c,x,y);
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |