Submission #1156111

#TimeUsernameProblemLanguageResultExecution timeMemory
1156111aarb_.tomatexdScales (IOI15_scales)C++20
55.56 / 100
0 ms328 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; void init(int T) {} void orderCoins() { int W[6] = {-1, -1, -1, -1, -1, -1}; vector<int> order = {1, 2, 3, 4, 5, 6}; for (int i = 0; i < 20; i++) swap(order[rand() % 6], order[rand() % 6]); int t1 = getLightest(order[1], order[2], order[3]); int t2 = getLightest(order[4], order[5], order[0]); vector<int> a1, a2; for (int i = 0; i < 6; i++) { if (t1 != i + 1 && (i + 1 == order[1] || i + 1 == order[2] || i + 1 == order[3])) a1.push_back(i + 1); if (t2 != i + 1 && (i + 1 == order[0] || i + 1 == order[5] || i + 1 == order[4])) a2.push_back(i + 1); } int dist = 1; while (dist == t1 || dist == t2) dist++; W[0] = getLightest(t1, t2, dist); if (t1 == W[0]) W[1] = getLightest(t2, a1[0], a1[1]); else W[1] = getLightest(t1, a2[0], a2[1]); vector<int> left; for (int i = 0; i < 6; i++) { if (i + 1 == W[0] || i + 1 == W[1]) continue; left.push_back(i + 1); } int res = getLightest(left[0], left[1], left[2]); int other = (left[0] == res) ? left[1] : left[0]; int res2 = getMedian(res, other, left[3]); if (res2 == res) { W[2] = left[3]; W[3] = res; W[4] = getMedian(left[0], left[1], left[2]); } else { W[2] = res; left.clear(); for (int i = 0; i < 6; i++) { if (i + 1 == W[0] || i + 1 == W[1] || i + 1 == W[2]) continue; left.push_back(i + 1); } W[3] = getLightest(left[0], left[1], left[2]); W[4] = getMedian(left[0], left[1], left[2]); } for (int i = 0; i < 6; i++) { if (i + 1 == W[0] || i + 1 == W[1] || i + 1 == W[2] || i + 1 == W[3] || i + 1 == W[4]) continue; W[5] = i + 1; } answer(W); }
#Verdict Execution timeMemoryGrader output
Fetching results...