Submission #1076133

#TimeUsernameProblemLanguageResultExecution timeMemory
1076133jk_Scales (IOI15_scales)C++14
45.45 / 100
1 ms348 KiB
#include <array>
#include <cassert>
#include <vector>
#include <algorithm>
#include "scales.h"
using namespace std;
void init(int) {}

void orderCoins() {
  vector<int> c{1,2,3,4,5,6};
  vector<int> ans;
  {
    int a = getLightest(1,2,3);
    int b = getLightest(4,5,6);
    ans.push_back(getLightest(a, b, (a==1 ? 2 : 1)));
    c.erase(find(c.begin(), c.end(),ans[0]));
  }
  {
    int a = getLightest(c[0], c[1], c[2]);
    int b = getLightest(a,    c[3], c[4]);
    ans.push_back(b);
    c.erase(find(c.begin(), c.end(), ans[1]));
  }
  {
    int a = getLightest(c[0], c[1], c[2]);
    int b = (a==c[0] ? c[1] : c[0]);
    ans.push_back(getLightest(a, b, c[3]));
    c.erase(find(c.begin(), c.end(), ans[2]));
  }
  {
    int a = getLightest(c[0], c[1], c[2]);
    ans.push_back(a);
    c.erase(find(c.begin(), c.end(), ans[3]));
  }
  {
    int a = getHeaviest(ans[0], c[0], c[1]);
    int b = a==c[0] ? c[1] : c[0];
    ans.push_back(b);
    ans.push_back(a);
  }
  answer(ans.data());
}
#Verdict Execution timeMemoryGrader output
Fetching results...