Submission #424962

#TimeUsernameProblemLanguageResultExecution timeMemory
424962ollelScales (IOI15_scales)C++14
55.56 / 100
1 ms296 KiB
#include <bits/stdc++.h> #include <iostream> #include "scales.h" using namespace std; #define rep(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define lso(x) x&(-x) typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; int t; void init(int T) {t = T;} void orderCoins() { vi a(3), b(3); a[0] = getLightest(1, 2, 3); a[1] = getMedian(1, 2, 3); rep(i, 1, 4) if (i != a[0] && i != a[1]) a[2] = i; b[0] = getLightest(4, 5, 6); b[1] = getMedian(4, 5, 6); rep(i, 4, 7) if (i != b[0] && i != b[1]) b[2] = i; vi o; o.pb(getLightest(a[0], a[1], b[0])); if (o[0] == a[0]) swap(a, b); // a has 3, b has 2 o.pb(getLightest(a[0], b[1], a[1])); if (o[1] == a[0]) { // a 2, b 2 int mini = getLightest(a[1], a[2], b[1]); if (mini == b[1]) swap(a, b); // a[1] < b[1] o.pb(a[1]); int x = getMedian(a[2], b[1], b[2]); if (x == a[2]) { o.pb(b[1]); o.pb(a[2]); o.pb(b[2]); } else if (x == b[1]) { o.pb(a[2]); o.pb(b[1]); o.pb(b[2]); } else { o.pb(b[1]); o.pb(b[2]); o.pb(a[2]); } } else { // a 3, b 1 int x = getNextLightest(a[0], a[1], a[2], b[2]); if (x == a[1]) { o.pb(a[0]); o.pb(b[2]); o.pb(a[1]); o.pb(a[2]); } else if (x == a[2]) { o.pb(a[0]); o.pb(a[1]); o.pb(b[2]); o.pb(a[2]); } else { int mini = getLightest(a[2], a[1], b[2]); if (mini == b[2]) { o.pb(b[2]); o.pb(a[0]); o.pb(a[1]); o.pb(a[2]); } else { o.pb(a[0]); o.pb(a[1]); o.pb(a[2]); o.pb(b[2]); } } } int aaa[6]; rep(i,0,6) aaa[i] = o[i]; answer(aaa); }
#Verdict Execution timeMemoryGrader output
Fetching results...