Submission #206393

#TimeUsernameProblemLanguageResultExecution timeMemory
206393batmendScales (IOI15_scales)C++14
Compilation error
0 ms0 KiB
#include "scales.h"
#include<bits/stdc++.h>
using namespace std;

void init(int T) {
int pos[7];
int ma;
int med;
int val0, val1, val2, val3;
}

void init(int T) {
    /* ... */
}

void orderCoins() {
    /* ... */
    int pos[7] = {0, 0, 1, 2, 3, 4, 5};
    int W[6] = {1, 2, 3, 4, 5, 6};
	ma = getHeaviest(1, 2, 3);
    swap(W[ma], W[2]);
    swap(pos[ma], pos[2]);
    ma = getHeaviest(4, 5, 6);
    swap(W[ma], W[5]);
    swap(pos[ma], pos[5]);
    

    ma = getHeaviest(W[1], W[2], W[5]);
    bool w2wasmax = 0;
    if (ma == W[2]) {
    	swap(pos[W[2]], pos[W[5]]);
    	swap(W[2], W[5]);
    	w2wasmax = 1;
    }
    if (w2wasmax == 1) {
    	ma = getHeaviest(W[0], W[1], W[2]);
    }
    if (w2wasmax == 0) {
    	ma = getHeaviest(W[3], W[4], W[2]);
    }
    int val = W[4];
    swap(W[pos[ma]], W[4]);
    swap(pos[val], pos[ma]);

    ma = getHeaviest(W[1], W[2], W[3]);
    val = W[3];
    swap(W[pos[ma]], W[3]);
    swap(pos[ma], pos[val]);
    med = getMedian(W[0], W[1], W[3]);
    val0 = W[0];
    val1 = W[1];
    val3 = W[3];
    if (med == val0) {
		swap(pos[W[0]], pos[W[1]]);
		swap(W[0], W[1]);
    }
    if (med == val3) {
			swap(pos[W[3]], pos[W[0]]);
			swap(W[0], W[3]);
			swap(pos[W[3]], pos[W[1]]);
			swap(W[1], W[3]);
    }
    med = getMedian(W[0], W[1], W[2]);
    val0 = W[0];
    val1 = W[1]; 
    val2 = W[2];
	if (med == val0) {
			swap(pos[W[0]], pos[W[2]]);
			swap(W[0], W[2]);
			swap(pos[W[1]], pos[W[0]]);
			swap(W[1], W[0]);
    }
    if (med == val2) {
			swap(pos[W[1]], pos[W[2]]);
			swap(W[1], W[2]);
    }
	answer(W);
}

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:6:5: warning: unused variable 'pos' [-Wunused-variable]
 int pos[7];
     ^~~
scales.cpp:7:5: warning: unused variable 'ma' [-Wunused-variable]
 int ma;
     ^~
scales.cpp:8:5: warning: unused variable 'med' [-Wunused-variable]
 int med;
     ^~~
scales.cpp:9:5: warning: unused variable 'val0' [-Wunused-variable]
 int val0, val1, val2, val3;
     ^~~~
scales.cpp:9:11: warning: unused variable 'val1' [-Wunused-variable]
 int val0, val1, val2, val3;
           ^~~~
scales.cpp:9:17: warning: unused variable 'val2' [-Wunused-variable]
 int val0, val1, val2, val3;
                 ^~~~
scales.cpp:9:23: warning: unused variable 'val3' [-Wunused-variable]
 int val0, val1, val2, val3;
                       ^~~~
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void init(int)':
scales.cpp:12:6: error: redefinition of 'void init(int)'
 void init(int T) {
      ^~~~
scales.cpp:5:6: note: 'void init(int)' previously defined here
 void init(int T) {
      ^~~~
scales.cpp:12:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:20:2: error: 'ma' was not declared in this scope
  ma = getHeaviest(1, 2, 3);
  ^~
scales.cpp:20:2: note: suggested alternative: 'fma'
  ma = getHeaviest(1, 2, 3);
  ^~
  fma
scales.cpp:49:5: error: 'med' was not declared in this scope
     med = getMedian(W[0], W[1], W[3]);
     ^~~
scales.cpp:49:5: note: suggested alternative: 'modf'
     med = getMedian(W[0], W[1], W[3]);
     ^~~
     modf
scales.cpp:50:5: error: 'val0' was not declared in this scope
     val0 = W[0];
     ^~~~
scales.cpp:50:5: note: suggested alternative: 'val'
     val0 = W[0];
     ^~~~
     val
scales.cpp:51:5: error: 'val1' was not declared in this scope
     val1 = W[1];
     ^~~~
scales.cpp:51:5: note: suggested alternative: 'val'
     val1 = W[1];
     ^~~~
     val
scales.cpp:52:5: error: 'val3' was not declared in this scope
     val3 = W[3];
     ^~~~
scales.cpp:52:5: note: suggested alternative: 'val'
     val3 = W[3];
     ^~~~
     val
scales.cpp:66:5: error: 'val2' was not declared in this scope
     val2 = W[2];
     ^~~~
scales.cpp:66:5: note: suggested alternative: 'val'
     val2 = W[2];
     ^~~~
     val