Submission #782870

#TimeUsernameProblemLanguageResultExecution timeMemory
782870fatemetmhrScales (IOI15_scales)C++17
0 / 100
1 ms304 KiB
// ~ Be Name Khoda ~ // #include "scales.h" #include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC target("avx2") //#pragma GCC optimize("unroll-loops,Ofast") using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fi first #define se second mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxn = 1e6 + 10; const int maxn5 = 5e5 + 10; const int maxnt = 1.2e6 + 10; const int maxn3 = 1e3 + 10; const int mod = 1e9 + 7; const ll inf = 1e18; /* getHeaviest(), getLightest(), getMedian(), getNextLightest(); */ void init(int T) { /* ... */ } void orderCoins() { vector <int> ret; int a[] = {1, 2, 3, 4, 5, 6}; int per[] = {1, 2, 3, 4, 5, 6}; shuffle(per, per + 6, rng); a[0] = getLightest(per[0], per[1], per[2]); a[1] = getMedian(per[0], per[1], per[2]); a[2] = (a[0] != per[0] && a[1] != per[0] ? per[0] : (a[0] != per[1] && a[1] != per[1] ? per[1] : per[2])); a[3] = getLightest(per[3], per[4], per[5]); a[4] = getMedian(per[3], per[4], per[5]); a[5] = (a[3] != per[3] && a[4] != per[3] ? per[3] : (a[3] != per[4] && a[4] != per[4] ? per[4] : per[5])); int x = getNextLightest(a[3], a[4], a[5], a[1]); if(x == a[3]){ x = getNextLightest(a[3], a[4], a[5], a[0]); if(x == a[3]){ x = getHeaviest(a[0], a[2], a[5]); if(x == a[2]) ret = {a[3], a[4], a[5], a[0], a[1], a[2]}; else ret = {a[0], a[1], a[2], a[3], a[4], a[5]}; } else if(x == a[4]) ret = {a[3], a[0], a[4], a[5], a[1], a[2]}; else if(x == a[5]) ret = {a[3], a[4], a[0], a[5], a[1], a[2]}; } else if(x == a[4]){ x = getNextLightest(a[4], a[5], a[1], a[2]); int y = getLightest(a[0], a[3], a[1]); if(y == a[0]) swap(a[0], a[3]); if(x == a[5]) ret = {a[3], a[0], a[1], a[4], a[2], a[5]}; else if(x == a[4]) ret = {a[3], a[0], a[1], a[2], a[4], a[5]}; else if(x == a[1]) ret = {a[3], a[0], a[1], a[4], a[5], a[2]}; } else if(x == a[5]){ x = getNextLightest(a[3], a[4], a[1], a[0]); int y = getHeaviest(a[2], a[5], a[1]); if(y == a[2]) // a[5] is max swap(a[2], a[5]); if(x == a[3]) ret = {a[0], a[3], a[4], a[1], a[2], a[5]}; else if(x == a[4]) ret = {a[3], a[0], a[4], a[1], a[2], a[5]}; else if(x == a[1]) ret = {a[3], a[4], a[0], a[1], a[2], a[5]}; } for(int i = 0; i < 6; i++) a[i] = ret[i]; answer(a); return; }

Compilation message (stderr)

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