Professional Documents
Culture Documents
<stdio.h>
#include <vector>
#include <algorithm>
int main()
{
while (true)
{
int l;
scanf("%d", &l);
if (!l)
{
break;
}
int n;
scanf("%d", &n);
std::vector<int> orig;
std::vector<int> cuts;
std::vector<bool> done;
do
{
/*
printf("permutation = ");
for (auto i: cuts)
{
printf("%d ", i);
}
printf("\n");
*/
int sum_lens = 0;
found = false;
for (j = i - 1; j >= 0; --j)
{
if (done[j])
{
found = true;
break;
}
}
int ldist = found ? orig[i] - orig[j] : orig[i];
// printf("j = %d, found = %d, ldist = %d\n", j,
found, ldist);
found = false;
for (j = i + 1; j < orig.size(); ++j)
{
if (done[j])
{
found = true;
break;
}
}
int rdist = found ? orig[j] - orig[i] : l -
orig[i];
// printf("j = %d, found = %d, rdist = %d\n", j,
found, rdist);
return 0;
}