Submission #138845

# Submission time Handle Problem Language Result Execution time Memory
138845 2019-07-30T13:31:20 Z dnass Scales (IOI15_scales) C++14
0 / 100
3 ms 632 KB
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;

int xxxxxxxxxxx;

void init(int T){
	xxxxxxxxxxx = T;
}

void orderCoins(){
	++xxxxxxxxxxx;
	int f3 = getHeaviest(1,2,3);
	int f1 = getLightest(1,2,3);
	int f2 = -1;
	for(int i=1;i<=3;i++){
		if(i!=f3&&i!=f1) f2 = i;
	}
	int f[] = {f1, f2, f3};
	int s3 = getHeaviest(4,5,6);
	int s1 = getLightest(4,5,6);
	int s2 = -1;
	for(int i=1;i<=3;i++){
		if(i!=s3&&i!=s1) s2 = i;
	}
	int s[] = {s1, s2, s3};
	int W[6];
	int x = 2, y = 2;
	while(x>0||y>0){
		if(x>0){
			if(getHeaviest(f[x], s[y], f[x-1])==f[x]){
				W[x+y+1] = f[x];
				x--;
			}else{
				W[x+y+1] = s[y];
				y--;
			}
		}else{
			if(getHeaviest(f[x], s[y], s[y-1])==f[x]){
				W[x+y+1] = f[x];
				x--;
			}else{
				W[x+y+1] = s[y];
				y--;
			}
		}
	}
	W[1] = f[0];
	W[0] = s[0];
	if(getMedian(f[0], s[0], W[2])==f[0]){
	}else{
		swap(W[1], W[0]);
	}
	answer(W);
	/*
	int x1 = getNextLightest(s1, s2, s3, f1);
	if(x1==s1){
		if(getHeaviest(s1,f1,s3)==f1){
			int W[6] = {s1, s2, s3, f1, f2, f3};
			answer(W);
		}else{

		}
	}else if(x1==s2){
		int x2 = getNextLightest(s2, s3, f3, f2);
		if(x2==f3){
			int x3 = getMedian(f2, s2, s3);
			if(x3==f2){
				int W[6] = {s1, f1, s2, f2, s3, f3};
				answer(W);
			}else if(x3==s2){
				int W[6] = {s1, f1, f2, f3, s2, f3};
				answer(W);
			}else{
				int W[6] = {s1, f1, s2, s3, f2, f3};
				answer(W);
			}
		}else if(x2==s3){
			int W[6] = {s1, f1, s2, f2, s3, f3};
			answer(W);
		}else{
			if(getHeaviest(s1, s3, f3)==s3){
				int W[6] = {s1, f1, f2, s2, f3, s3};
				answer(W);
			}else{
				int W[6] = {s1, f1, f2, s2, s3, f3};
				answer(W);
			}
		}
	}else{
		int x2 = getMedian(f2, f3, s3);
		if(x2==s3){
			int W[6] = {s1, s2, f1, f2, s3, f3};
			answer(W);
		}else if(x2==f2){	
			int W[6] = {s1, s2, f1, s3, f2, f3};
			answer(W);
		}else{
			int W[6] = {s1, s2, f1, f2, f3, s3};
			answer(W);
		}
	}
	*/
}
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Incorrect 2 ms 256 KB Output isn't correct
3 Runtime error 2 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Incorrect 2 ms 376 KB Output isn't correct
6 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Incorrect 2 ms 256 KB Output isn't correct
18 Incorrect 2 ms 252 KB Output isn't correct
19 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
21 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
22 Runtime error 2 ms 488 KB Execution killed with signal 11 (could be triggered by violating memory limits)
23 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
24 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
25 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
26 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
27 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
28 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
29 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
30 Incorrect 2 ms 256 KB Output isn't correct
31 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
33 Runtime error 3 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
34 Runtime error 3 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
35 Incorrect 2 ms 376 KB Output isn't correct
36 Incorrect 2 ms 376 KB Output isn't correct
37 Incorrect 2 ms 256 KB Output isn't correct
38 Incorrect 2 ms 256 KB Output isn't correct
39 Runtime error 2 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
40 Runtime error 3 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)