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 <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#define task_count 10
int main()
{
uint8_t swap = 0;
uint8_t tasks[task_count] = {0,1,2,3,4,5,6,7,8,9};
uint8_t * cpy_tasks = (uint8_t *)malloc(task_count);
uint8_t deadline[task_count] = {2,3,7,1,5,4,9,0,6,8};
memcpy(cpy_tasks, tasks, 10);
uint8_t temp;
for (size_t i = 0; i < task_count; i++)
{
if(tasks[i] != cpy_tasks[deadline[i]])
{
temp = tasks[i];
tasks[i] = cpy_tasks[deadline[i]];
swap += deadline[i] - i;
tasks[deadline[i]] = temp;
}
}
printf("%d", swap);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |