Submission #593489

#TimeUsernameProblemLanguageResultExecution timeMemory
593489gagik_2007Scales (IOI15_scales)C++17
45.45 / 100
1 ms304 KiB
#include "scales.h" #include <iostream> #include <algorithm> #include <string> #include <vector> #include <cmath> #include <ctime> #include <set> #include <map> #include <stack> #include <queue> #include <deque> #include <limits> #include <iomanip> #include <unordered_set> #include <unordered_map> #include <random> using namespace std; typedef long long ll; typedef long double ld; typedef ll itn; #define ff first #define ss second ll n; const ll INF = 1e18; const ll MOD = 1e9 + 7; const ll MOD2 = 998244353; const ll MOD3 = 32768; const ll N = 100007; ll ttt; int ans[6]; class Xumb { public: int L; int M; int H; int sum; int cnt; Xumb() { L = M = H = -1; sum = 0; cnt = 0; } Xumb(int s) { sum = s; cnt = 0; } Xumb(int l, int m, int s) { L = l; M = m; sum = s; H = calc_h(); cnt = 0; } int calc_h() { return sum - L - M; } int get_num() { if (cnt == 0)return L; else if (cnt == 1)return M; else if (cnt == 2)return H; else return -1; } }; void init(int T) { ttt = T; } void orderCoins() { Xumb a(getLightest(1, 2, 3), getMedian(1, 2, 3), 1 + 2 + 3); Xumb b(getLightest(4, 5, 6), getMedian(4, 5, 6), 4 + 5 + 6); int ind = 0; while (ind < 4 && a.get_num() != -1 && b.get_num() != -1) { if (a.cnt < 2) { ans[ind] = getLightest(a.get_num(), a.H, b.get_num()); } else { ans[ind] = getLightest(a.get_num(), b.H, b.get_num()); } if (ans[ind] == a.get_num())a.cnt++; else b.cnt++; ind++; } if (a.get_num() == -1) { while (b.get_num() != -1) { ans[ind] = b.get_num(); b.cnt++; ind++; } } else if (b.get_num() == -1) { while (a.get_num() != -1) { ans[ind] = a.get_num(); a.cnt++; ind++; } } else { for (int i = 1; i <= 6; i++) { if (i != a.get_num() && i != b.get_num()) { ans[5] = getHeaviest(i, a.get_num(), b.get_num()); ans[4] = a.get_num() + b.get_num() - ans[5]; answer(ans); return; } } } answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...