Submission #93468

#TimeUsernameProblemLanguageResultExecution timeMemory
93468tincamateiScales (IOI15_scales)C++14
45.45 / 100
2 ms380 KiB
#include <vector>
#include "scales.h"

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

void eraseVector(int val, std::vector<int> &x) {
  int i = 0;
  while(x[i] != val)
    ++i;
  x.erase(x.begin() + i);
}

int w[6];

void orderCoins() {
  std::vector<int> x{1, 2, 3, 4, 5, 6};

  int lgt, lgt2;
  lgt = getLightest(x[0], x[1], x[2]);
  lgt2 = getLightest(x[3], x[4], x[5]);
  if(lgt == x[0]) lgt = getLightest(lgt, lgt2, x[1]);
  else            lgt = getLightest(lgt, lgt2, x[0]);
  w[0] = lgt;
  eraseVector(lgt, x);

  lgt = getLightest(x[0], x[1], x[2]);
  lgt = getLightest(lgt, x[3], x[4]);
  w[1] = lgt;
  eraseVector(lgt, x);

  lgt = getLightest(x[0], x[1], x[2]);
  if(x[0] != lgt) lgt = getLightest(x[3], lgt, x[0]);
  else            lgt = getLightest(x[3], lgt, x[1]);
  w[2] = lgt;
  eraseVector(lgt, x);

  lgt = getLightest(x[0], x[1], x[2]);
  w[3] = lgt;

  lgt = getMedian(x[0], x[1], x[2]);
  w[4] = lgt;

  w[5] = x[0] + x[1] + x[2] - w[3] - w[4];

  answer(w);
}

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...