Submission #292356

#TimeUsernameProblemLanguageResultExecution timeMemory
292356VodkaInTheJar저울 (IOI15_scales)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "scales.h"

using namespace std;


void init(int t)
{

}


vector <int> merge(vector <int> v, int x)
{
	int sz = (int)v.size();
	
	vector <int> ans;
	if (sz == 2)
	{
		int temp = getMedian(v[0], v[1], x)l
		if (temp == x)
		return {v[0], x, v[1]}l;
		
		else 
		if (temp == v[0])
		return {x, v[0], v[1]};
		
		else 
		return {v[0], v[1], x};
	}
	
	int temp = getHeaviest(v[sz-2], v[sz-1], x);
	if (temp == x)
	{
		ans = v;
		ans.push_back(x);
		return ans; 
	}
	
	else 
	{
		int pre = v[sz-1];
		v.pop_back();
		
		ans = merge(v, x);
		ans.push_back(pre);
		return ans; 
	}
}

int shit[6];
void orderCoins()
{
	vector <int> ans; 
	ans.push_back(getLightest(1, 2, 3));
	ans.push_back(getMedian(1, 2, 3));
	if (ans[0] != 1 && ans[1] != 1)
	ans.push_back(1);
	
	if (ans[0] != 2 && ans[1] != 2)
	ans.push_back(2);
	
	if (ans[0] != 3 && ans[1] != 3)
	ans.push_back(3);
	
	for (int i = 4; i <= 6; i++)
	ans = merge(ans, i);
	
	for (int i = 0; i < 6; i++)
	shit[i] = ans[i];
	
	answer(shit);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 't' [-Wunused-parameter]
    7 | void init(int t)
      |           ~~~~^
scales.cpp: In function 'std::vector<int> merge(std::vector<int>, int)':
scales.cpp:20:38: error: expected ',' or ';' before 'l'
   20 |   int temp = getMedian(v[0], v[1], x)l
      |                                      ^
scales.cpp:22:25: error: 'l' was not declared in this scope
   22 |   return {v[0], x, v[1]}l;
      |                         ^
scales.cpp:20:7: warning: unused variable 'temp' [-Wunused-variable]
   20 |   int temp = getMedian(v[0], v[1], x)l
      |       ^~~~
scales.cpp:24:3: error: expected '}' before 'else'
   24 |   else
      |   ^~~~
scales.cpp:19:2: note: to match this '{'
   19 |  {
      |  ^
scales.cpp:25:7: error: 'temp' was not declared in this scope
   25 |   if (temp == v[0])
      |       ^~~~
scales.cpp: At global scope:
scales.cpp:32:25: error: 'v' was not declared in this scope
   32 |  int temp = getHeaviest(v[sz-2], v[sz-1], x);
      |                         ^
scales.cpp:32:27: error: 'sz' was not declared in this scope
   32 |  int temp = getHeaviest(v[sz-2], v[sz-1], x);
      |                           ^~
scales.cpp:32:34: error: 'v' was not declared in this scope
   32 |  int temp = getHeaviest(v[sz-2], v[sz-1], x);
      |                                  ^
scales.cpp:32:36: error: 'sz' was not declared in this scope
   32 |  int temp = getHeaviest(v[sz-2], v[sz-1], x);
      |                                    ^~
scales.cpp:32:43: error: 'x' was not declared in this scope
   32 |  int temp = getHeaviest(v[sz-2], v[sz-1], x);
      |                                           ^
scales.cpp:33:2: error: expected unqualified-id before 'if'
   33 |  if (temp == x)
      |  ^~
scales.cpp:40:2: error: expected unqualified-id before 'else'
   40 |  else
      |  ^~~~
scales.cpp:49:1: error: expected declaration before '}' token
   49 | }
      | ^
scales.cpp: In function 'std::vector<int> merge(std::vector<int>, int)':
scales.cpp:17:15: warning: control reaches end of non-void function [-Wreturn-type]
   17 |  vector <int> ans;
      |               ^~~