# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
394574 | rainboy | Scales (IOI15_scales) | C11 | 1 ms | 208 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 "scales.h"
void init(int T) {}
void orderCoins() {
static int aa[3], bb[3], cc[6];
int i, j, k, tmp;
aa[0] = getLightest(1, 2, 3), aa[1] = getMedian(1, 2, 3), aa[2] = aa[0] ^ aa[1];
bb[0] = getLightest(4, 5, 6), bb[1] = getMedian(4, 5, 6), bb[2] = bb[0] ^ bb[1] ^ 7;
i = 0, j = 0, k = 0;
while (i < 3 && j < 3)
if (i == 2 && j == 2)
cc[k++] = getMedian(cc[0], aa[i], bb[j]) == aa[i] ? aa[i++] : bb[j++];
else if (i < j) {
int x = getMedian(aa[i], aa[i + 1], bb[j]);
if (x == aa[i])
cc[k++] = bb[j], j++;
else if (x == bb[j])
cc[k++] = aa[i], cc[k++] = bb[j], i++, j++;
else
cc[k++] = aa[i], cc[k++] = aa[i + 1], i += 2;
} else {
int x = getMedian(bb[j], bb[j + 1], aa[i]);
if (x == bb[j])
cc[k++] = aa[i], i++;
else if (x == aa[i])
cc[k++] = bb[j], cc[k++] = aa[i], j++, i++;
else
cc[k++] = bb[j], cc[k++] = bb[j + 1], j += 2;
}
while (i < 3)
cc[k++] = aa[i++];
while (j < 3)
cc[k++] = bb[j++];
answer(cc);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |