Submission #1017271

#TimeUsernameProblemLanguageResultExecution timeMemory
1017271parsadox2Scales (IOI15_scales)C++17
55.56 / 100
1 ms600 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; int tc; void init(int T) { tc = T; } void orderCoins() { int mn = 1 , mx = 2; vector <int> vec; for(int i = 3 ; i <= 6 ; i++) { //cout << mn << " " << i << " " << mx << endl; int mid = getMedian(mn , i , mx); if(mid == mn) { vec.push_back(mn); mn = i; } else if(mid == mx) { vec.push_back(mx); mx = i; } else { vec.push_back(i); } } if(mn != getLightest(mn , vec[0] , mx)) swap(mn , mx); //cout << mn << " " << vec[0] << " " << mx << endl; int id = getMedian(vec[1] , vec[2] , vec[3]); //cout << vec[1] if(id == vec[1]) swap(vec[1] , vec[2]); else if(id == vec[3]) swap(vec[3] , vec[2]); id = getLightest(vec[0] , vec[1] , vec[3]); if(id == vec[0]) { id = getLightest(vec[1] , vec[2] , vec[3]); if(id != vec[1]) swap(vec[1] , vec[3]); } else { if(id == vec[3]) swap(vec[1] , vec[3]); swap(vec[1] , vec[0]); int bad = vec[1]; id = getNextLightest(vec[2] , vec[3] , mx , bad); if(id == mx) { vec[1] = vec[2]; vec[2] = vec[3]; vec[3] = bad; } else if(id == vec[3]) swap(vec[1] , vec[2]); } int W[6]; W[0] = mn; W[5] = mx; for(int i = 1 ; i < 5 ; i++) W[i] = vec[i - 1]; answer(W); }
#Verdict Execution timeMemoryGrader output
Fetching results...