Submission #744578

#TimeUsernameProblemLanguageResultExecution timeMemory
744578Abrar_Al_SamitScales (IOI15_scales)C++17
55.56 / 100
1 ms296 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::system_clock::now().time_since_epoch().count()); void init(int T) { } void solve3(int *a) { int mn = getLightest(*a, *(a+1), *(a+2)); if(mn==*(a+1)) swap(*a, *(a+1)); else if(mn==*(a+2)) swap(*a, *(a+2)); int mx = getHeaviest(*a, *(a+1), *(a+2)); if(mx==*(a+1)) swap(*(a+1), *(a+2)); } void orderCoins() { int a[6] = {1, 2, 3, 4, 5, 6}; shuffle(a, a+6, rng); solve3(&a[0]); solve3(&a[3]); if(getLightest(a[0], a[1], a[3])==a[3]) { swap(a[0], a[3]); swap(a[1], a[4]); swap(a[2], a[5]); } int before = getNextLightest(a[0], a[1], a[2], a[3]); if(before==a[1]) { swap(a[2], a[3]); swap(a[1], a[2]); } else if(before==a[2]) { swap(a[2], a[3]); } else { answer(a); return; } before = getNextLightest(a[1], a[2], a[3], a[4]); if(before==a[2]) { swap(a[3], a[4]); swap(a[2], a[3]); //take median int med = getMedian(a[3], a[4], a[5]); if(med==a[3]) { swap(a[5], a[4]); swap(a[4], a[3]); } else if(med==a[5]) { swap(a[5], a[4]); } } else if(before==a[3]) { swap(a[3], a[4]); //take max int mx = getHeaviest(a[3], a[4], a[5]); if(mx==a[4]) { swap(a[4], a[5]); } } else { answer(a); return; } answer(a); }

Compilation message (stderr)

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