Submission #730274

#TimeUsernameProblemLanguageResultExecution timeMemory
730274NeroZeinScales (IOI15_scales)C++17
45.45 / 100
1 ms304 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { } void orderCoins() { int w[6] = {}; vector<int> a(3), b(3); a[2] = getHeaviest(1, 2, 3); a[0] = getLightest(1, 2, 3); a[1] = 1 ^ 2 ^ 3 ^ a[0] ^ a[2]; b[2] = getHeaviest(4, 5, 6); b[0] = getLightest(4, 5, 6); b[1] = 4 ^ 5 ^ 6 ^ b[0] ^ b[2]; //4 queries int x = getNextLightest(a[0], a[1], a[2], b[0]); bool MnIsInB = true; if (x == a[0]) { int y = getLightest(a[0], a[1], b[0]); if (y != b[0]) { MnIsInB = false; } } else { MnIsInB = false; } vector<int> ans; if (MnIsInB) {///if returned b[0] then a[i] is bigger than b[2] ans = b; //cout << "MnIsInB" << '\n'; for (int i = 0; i <= 2; ++i) { x = getNextLightest(b[0], b[1], b[2], a[i]); if (x == b[0]) { ans.insert(ans.begin() + ans.size(), a[i]); } else { for (int j = 0; j < (int) ans.size(); ++j) { if (ans[j] == x) { ans.insert(ans.begin() + j, a[i]); break; } } } //for (int j = 0; j < (int) ans.size(); ++j) { //cout << ans[j] << ' '; //} //cout << '\n'; } } else {///if returned a[0] then b[i] is bigger than a[2] ans = a; for (int i = 0; i <= 2; ++i) { x = getNextLightest(a[0], a[1], a[2], b[i]); if (x == a[0]) { ans.insert(ans.begin() + ans.size(), b[i]); } else { for (int j = 0; j < (int) ans.size(); ++j) { if (ans[j] == x) { ans.insert(ans.begin() + j, b[i]); break; } } } } } for (int i = 0; i < 6; ++i) { w[i] = ans[i]; } answer(w); }

Compilation message (stderr)

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