Submission #128128

# Submission time Handle Problem Language Result Execution time Memory
128128 2019-07-10T12:51:29 Z kingfran1907 Scales (IOI15_scales) C++14
0 / 100
6 ms 380 KB
#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

scales.cpp: In function 'void init(int)':
scales.cpp:10:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 256 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 252 KB Output isn't correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 Incorrect 2 ms 256 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Incorrect 2 ms 376 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Incorrect 2 ms 256 KB Output isn't correct
17 Incorrect 2 ms 256 KB Output isn't correct
18 Incorrect 2 ms 380 KB Output isn't correct
19 Incorrect 2 ms 256 KB Output isn't correct
20 Incorrect 2 ms 376 KB Output isn't correct
21 Incorrect 2 ms 376 KB Output isn't correct
22 Incorrect 2 ms 376 KB Output isn't correct
23 Incorrect 2 ms 256 KB Output isn't correct
24 Incorrect 2 ms 376 KB Output isn't correct
25 Incorrect 2 ms 376 KB Output isn't correct
26 Incorrect 2 ms 256 KB Output isn't correct
27 Incorrect 6 ms 376 KB Output isn't correct
28 Incorrect 2 ms 252 KB Output isn't correct
29 Incorrect 2 ms 256 KB Output isn't correct
30 Incorrect 4 ms 376 KB Output isn't correct
31 Incorrect 2 ms 252 KB Output isn't correct
32 Incorrect 2 ms 256 KB Output isn't correct
33 Incorrect 2 ms 256 KB Output isn't correct
34 Incorrect 2 ms 376 KB Output isn't correct
35 Incorrect 2 ms 256 KB Output isn't correct
36 Incorrect 1 ms 376 KB Output isn't correct
37 Incorrect 2 ms 252 KB Output isn't correct
38 Incorrect 2 ms 256 KB Output isn't correct
39 Incorrect 3 ms 376 KB Output isn't correct
40 Incorrect 2 ms 376 KB Output isn't correct