Submission #128128

#TimeUsernameProblemLanguageResultExecution timeMemory
128128kingfran1907Scales (IOI15_scales)C++14
0 / 100
6 ms380 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; const int maxn = 10; int fir[maxn]; int sec[maxn]; void init(int T) { /* ... */ } void orderCoins() { /* ... */ int w[] = {1, 2, 3, 4, 5, 6}; fir[0] = getLightest(1, 2, 3); fir[1] = getMedian(1, 2, 3); fir[2] = 1 + 2 + 3 - fir[0] - fir[1]; sec[0] = getLightest(4, 5, 6); sec[1] = getMedian(4, 5, 6); sec[2] = 4 + 5 + 6 - sec[0] - sec[1]; int ptr1 = 0, ptr2 = 0; int ptr = 0; while (ptr < 6) { if (ptr1 == 3) { for (int i = ptr2; i < 3; i++) w[ptr++] = sec[i]; ptr2 = 3; } else if (ptr2 == 3) { for (int i = ptr1; i < 3; i++) w[ptr++] = fir[i]; ptr1 = 3; } else if (ptr == 5) { if (ptr1 == 2) w[ptr] = fir[ptr1], ptr++, ptr1++; else if (ptr2 == 2) w[ptr] = sec[ptr2], ptr++, ptr2++; } else if (ptr1 == 2 && ptr2 == 2) { w[ptr] = getMedian(fir[2], sec[2], w[0]); w[ptr + 1] = fir[2] + sec[2] - w[ptr]; ptr += 2, ptr1++, ptr2++; } else if (ptr1 < 2) { int x = getMedian(fir[ptr1], fir[ptr1 + 1], sec[ptr2]); if (x == fir[ptr1 + 1]) { w[ptr] = fir[ptr1]; w[ptr + 1] = fir[ptr1 + 1]; w[ptr + 2] = sec[ptr2]; ptr += 3, ptr1 += 2, ptr2++; } else if (x == fir[ptr]) { w[ptr] = sec[ptr2]; w[ptr + 1] = fir[ptr1]; w[ptr + 2] = fir[ptr1 + 1]; ptr += 3, ptr1 += 2, ptr2++; } else { w[ptr] = fir[ptr1]; w[ptr + 1] = sec[ptr]; w[ptr + 2] = fir[ptr + 1]; ptr += 3, ptr1 += 2, ptr2++; } } else if (ptr2 < 2) { int x = getMedian(sec[ptr2], sec[ptr2 + 1], fir[ptr1]); if (x == sec[ptr2 + 1]) { w[ptr] = sec[ptr2]; w[ptr + 1] = sec[ptr2 + 1]; w[ptr + 2] = fir[ptr1]; ptr += 3, ptr2 += 2, ptr1++; } else if (x == sec[ptr2]) { w[ptr] = fir[ptr1]; w[ptr + 1] = sec[ptr2]; w[ptr + 2] = sec[ptr2 + 1]; ptr += 3, ptr2 += 2, ptr1++; } else { w[ptr] = sec[ptr2]; w[ptr + 1] = fir[ptr1]; w[ptr + 2] = sec[ptr2 + 1]; ptr += 3, ptr2 += 2, ptr1++; } } } answer(w); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:10:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...