Submission #595948

#TimeUsernameProblemLanguageResultExecution timeMemory
595948ApiramScales (IOI15_scales)C++14
0 / 100
1 ms212 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { //1 2 3 4 5 6 // 5 - operations to get first and last value -> call median 4times then maximum or minimum 1 times // 2 - median call to get middle value // 2 call to do remaining // 9 calls to sort } //3 4 6 2 1 5 void orderCoins() { vector<int>ans = {1,2,3,4,5,6}; auto exchange = [&](int i,int j){ for (auto x:{0,1,2,3,4,5}){ if (ans[x] == i){ans[x] = j;} else if (ans[x] == j)ans[x] =i; } }; //3 int a = getLightest(ans[0],ans[1],ans[2]); exchange(a,ans[0]); int b = getLightest(ans[3],ans[4],ans[5]); exchange(b,ans[3]); int c = getLightest(ans[0],ans[1],ans[3]); if (c == ans[0]){ int d = getLightest(ans[1],ans[2],ans[3]); exchange(d,ans[1]); } else{ exchange(ans[3],ans[0]); int d = getLightest(ans[3],ans[4],ans[5]); exchange(d,ans[1]); } a = getHeaviest(ans[2],ans[3],ans[4]); exchange(a,ans[4]); a = getHeaviest(ans[3],ans[4],ans[5]); exchange(a,ans[5]); a = getLightest(ans[2],ans[3],ans[4]); exchange(a,ans[2]); answer(ans.data()); return; }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...