Submission #1017169

#TimeUsernameProblemLanguageResultExecution timeMemory
1017169huutuanScales (IOI15_scales)C++14
0 / 100
1 ms604 KiB
#include "scales.h"

#include <bits/stdc++.h>

using namespace std;

void init(int T) {
}

int ans[6];

void orderCoins() {
   vector<int> v{1, 2, 3, 4, 5, 6}, v2;
   while ((int)v.size()>=3){
      int t=getLightest(v[0], v[1], v[2]);
      for (int i=(int)v.size()-1; i>=3; i-=2){
         if (i!=3) t=getLightest(t, v[i], v[i-1]);
         else t=getLightest(t, v[3], t^v[2]^v[1]);
      }
      v2.push_back(t);
      ans[t-1]=(int)v2.size();
      v.erase(find(v.begin(), v.end(), t));
   }
   int t=getMedian(v[0], v[1], v2[0]);
   ans[t-1]=5;
   ans[(v[0]^v[1]^t)-1]=6;
   answer(ans);
}

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) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...