Submission #1013233

#TimeUsernameProblemLanguageResultExecution timeMemory
1013233d4xnScales (IOI15_scales)C++17
55.73 / 100
1 ms604 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; const int N = 6; mt19937 rng(time(nullptr) + 69); int c[N], ans[N]; void init(int T) { for (int i = 0; i < N; i++) { c[i] = i+1; } shuffle(c, c+N, rng); } void orderCoins() { shuffle(c, c+N, rng); vector<int> L; int x = getLightest(c[0], c[1], c[2]); int z = getHeaviest(c[0], c[1], c[2]); int y = c[0]; if (y == x || y == z) y = c[1]; if (y == x || y == z) y = c[2]; L.push_back(x); L.push_back(y); L.push_back(z); vector<int> R; x = getLightest(c[3], c[4], c[5]); z = getHeaviest(c[3], c[4], c[5]); y = c[3]; if (y == x || y == z) y = c[4]; if (y == x || y == z) y = c[5]; R.push_back(x); R.push_back(y); R.push_back(z); int mx = getHeaviest(L[2], R[2], L[0]); if (L.back() == mx) swap(L, R); L.push_back(mx); R.pop_back(); x = getNextLightest(L[3], L[2], L[1], R[1]); if (x == L[1]) { x = getMedian(L[0], R[0], R[1]); if (x == L[0]) { L.insert(L.begin()+1, R[1]); L.insert(L.begin(), R[0]); } else if (x == R[0]) { L.insert(L.begin()+1, R[1]); L.insert(L.begin()+1, R[0]); } else { L.insert(L.begin(), R[1]); L.insert(L.begin(), R[0]); } } else { int idx = 1; while (x != L[idx]) idx++; L.insert(L.begin() + idx, R[1]); //R.pop_back(); if (R[1] == L[3]) { x = getNextLightest(L[3], L[2], L[1], R[0]); if (x == L[1]) { x = getLightest(L[0], R[0], L[1]); if (x == R[0]) { L.insert(L.begin(), R[0]); } else { L.insert(L.begin()+1, R[0]); } R.pop_back(); } else { idx = 1; while (x != L[idx]) idx++; L.insert(L.begin() + idx, R[0]); R.pop_back(); } } else { x = getNextLightest(L[2], L[1], L[0], R[0]); idx = 0; while (x != L[idx]) idx++; L.insert(L.begin() + idx, R[0]); } } for (int i = 0; i < N; i++) { ans[i] = L[i]; //cerr << ans[i] << " "; }//cerr << endl; answer(ans); } /* void orderCoins() { shuffle(coins, coins+N, rng); vector<int> v; int x = getLightest(coins[0], coins[1], coins[2]); int z = getHeaviest(coins[0], coins[1], coins[2]); int y = coins[0]; if (y == x || y == z) y = coins[1]; if (y == x || y == z) y = coins[2]; v.push_back(x); v.push_back(y); v.push_back(z); int nwZ = getHeaviest(coins[3], coins[4], coins[5]); int mx = getHeaviest(z, nwZ, y); if (v.back() != mx) v.push_back(mx) { // me falta mirar dos int nwX = coins[4]; if (nwX == mx) nwX = coins[5]; int nwY = coins[5]; if (nwXY == mx || nwY == nwX) nwY = coins[6]; int idx = getNextLightest(x, y, z, ); } else { // me falta mirar tres } answer(ans); } */

Compilation message (stderr)

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