제출 #42215

#제출 시각아이디문제언어결과실행 시간메모리
42215MatheusLealV저울 (IOI15_scales)C++14
45.45 / 100
2 ms800 KiB
#include <bits/stdc++.h>
#include "scales.h"
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;

int n = 6, v[10], ord[10];

int sobra(int a, int b, int c, int x, int y)
{
	if(x == a && y == b) return c;

	if(y == a && x == b) return c;

	if(x == a && y == c) return b;

	if(y == a && x == c) return b;

	if(x == b && y == c) return a;

	if(y == b && x == c) return a;
}


void orderCoins()
{
	int ans[6], a[4], b[4];

	a[1] = getLightest(1, 2, 3), a[2] = getMedian(1, 2, 3), a[3] = sobra(1, 2, 3, a[1], a[2]);

	b[1] = getLightest(4, 5, 6), b[2] = getMedian(4, 5, 6), b[3] = sobra(4, 5, 6, b[1], b[2]);

	int pl = 1, pr = 1;

	for(int i = 0; i < 6; i++)
	{
		if(!i)
		{
			ans[0] = getLightest(a[1], b[1], a[2]);

			if(ans[0] == a[1]) pl ++;

			else pr ++;
		}

		else
		{
			if(pl <= 3 && pr <= 3)
			{
				ans[i] = getMedian(ans[0], a[pl], b[pr]);

				if(ans[i] == a[pl]) pl ++;

				else pr ++;
			}

			else if(pl > 3) ans[i] = b[pr], pr ++;

			else ans[i] = a[pl], pl ++;
		}
	}

	answer(ans);
}

void init(int T)
{
}

컴파일 시 표준 에러 (stderr) 메시지

scales.cpp:67:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T)
               ^
scales.cpp: In function 'int sobra(int, int, int, int, int)':
scales.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...