Submission #689774

#TimeUsernameProblemLanguageResultExecution timeMemory
689774mychecksedadScales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include <scales.h>
using namespace std;

void init(int T){

}

void answer(int W[]);

int getMedian(int A, int B, int C);
int getHeaviest(int A, int B, int C);
int getLightest(int A, int B, int C);
int getNextLightest(int A, int B, int C, int D);

void verase(int x, vector<int> &v){
	for(int i = 0; i < v.size(); ++i){
		if(v[i] == x){
			v.erase(v.begin() + i);
			return;
		}
	}
}

void orderCoins() {
    int W[6];
    vector<int> v {1, 2, 3, 4, 5, 6};
    int mx = getHeaviest(v[0], v[1], v[2]);
    mx = getHeaviest(mx, v[3], v[4]);
    mx = getHeaviest(mx, v[5], mx==v[4]?v[3]:v[4]);
    W[5] = mx;
    verase(mx, v);

    mx = getHeaviest(v[0], v[1], v[2]);
    mx = getHeaviest(mx, v[3], v[4]);
    W[4] = mx;
    verase(mx, v);

    mx = getHeaviest(v[0], v[1], v[2]);
    mx = getHeaviest(mx, v[3], mx==v[2]?v[1]:v[2]);
    W[3] = mx;
    verase(mx, v);

    mx = getHeaviest(v[0], v[1], v[2]);
    W[2] = mx;

    W[0] = getLightest(v[0], v[1], v[2]);
    verase(W[0]);
    verase(W[2]);
    W[1] = v[0];

    answer(W);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
    5 | void init(int T){
      |           ~~~~^
scales.cpp: In function 'void verase(int, std::vector<int>&)':
scales.cpp:17:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for(int i = 0; i < v.size(); ++i){
      |                 ~~^~~~~~~~~~
scales.cpp: In function 'void orderCoins()':
scales.cpp:48:16: error: too few arguments to function 'void verase(int, std::vector<int>&)'
   48 |     verase(W[0]);
      |                ^
scales.cpp:16:6: note: declared here
   16 | void verase(int x, vector<int> &v){
      |      ^~~~~~
scales.cpp:49:16: error: too few arguments to function 'void verase(int, std::vector<int>&)'
   49 |     verase(W[2]);
      |                ^
scales.cpp:16:6: note: declared here
   16 | void verase(int x, vector<int> &v){
      |      ^~~~~~