Submission #604403

#TimeUsernameProblemLanguageResultExecution timeMemory
604403wiwihoScales (IOI15_scales)C++14
0 / 100
1 ms340 KiB
#include "scales.h" #include <bits/stdc++.h> #define iter(a) a.begin(), a.end() #define lsort(a) sort(iter(a)) #define gsort(a) sort(iter(a), greater<>()) #define eb emplace_back #define ef emplace_front #define pob pop_back() #define pof pop_front() #define mp make_pair #define F first #define S second #define uni(a) a.resize(unique(iter(a)) - a.begin()) #define printv(a, b){ \ for(auto pv : a) b << pv << " "; \ b << "\n"; \ } using namespace std; typedef long long ll; typedef long double ld; using pii = pair<int, int>; using pll = pair<ll, ll>; template<typename A, typename B> ostream& operator<<(ostream& o, pair<A, B> p){ return o << '(' << p.F << ',' << p.S << ')'; } void init(int T){ } vector<int> solve(){ vector<int> A, B; { int l = getLightest(1, 2, 3); int r = getHeaviest(1, 2, 3); A.eb(l); A.eb(l ^ r ^ 1 ^ 2 ^ 3); A.eb(r); } { int l = getLightest(4, 5, 6); int r = getHeaviest(4, 5, 6); B.eb(l); B.eb(l ^ r ^ 4 ^ 5 ^ 6); B.eb(r); } int tmp = getMedian(A[1], A[2], B[2]); if(tmp == A[2]){ // A[0] A[1] A[2] B[2] tmp = getMedian(A[1], A[2], B[1]); if(tmp == A[2]){ // A[0] A[1] A[2] B[1] B[2] tmp = getMedian(A[0], A[1], B[0]); if(tmp == A[0]) return {B[0], A[0], A[1], A[2], B[1], B[2]}; else if(tmp == B[0]) return {A[0], B[0], A[1], A[2], B[1], B[2]}; else{ tmp = getMedian(A[1], B[0], A[2]); if(tmp == B[0]) return {A[0], A[1], B[0], A[2], B[1], B[2]}; else return {A[0], A[1], A[2], B[0], B[1], B[2]}; } } else if(tmp == B[1]){ // A[0] A[1] B[1] A[2] B[2] tmp = getMedian(A[0], A[1], B[0]); if(tmp == A[1]) return {A[0], A[1], B[0], B[1], A[2], B[2]}; else if(tmp == B[0]) return {A[0], B[0], A[1], B[1], A[2], B[2]}; else return {B[0], A[0], A[1], B[1], A[2], B[2]}; } else{ // A[0] B[1] A[1] A[2] B[2] tmp = getMedian(A[0], B[0], B[1]); if(tmp == B[0]) return {A[0], B[0], B[1], A[1], A[2], B[2]}; else return {B[0], A[0], B[1], A[1], A[2], B[2]}; } } else if(tmp == B[2]){ // A[0] A[1] B[2] A[2] tmp = getMedian(A[0], A[1], B[1]); if(tmp == A[1]){ // A[0] A[1] B[1] B[2] A[2] tmp = getMedian(A[0], A[1], B[0]); if(tmp == A[1]) return {A[0], A[1], B[0], B[1], B[2], A[2]}; else if(tmp == B[0]) return {A[0], B[0], A[1], B[1], B[2], A[2]}; else return {B[0], A[0], A[1], B[1], B[2], A[2]}; } else if(tmp == B[1]){ // A[0] B[1] A[1] B[2] A[2] tmp = getMedian(B[0], A[0], B[1]); if(tmp == A[0]) return {B[0], A[0], B[1], A[1], B[2], A[2]}; else return {A[0], B[0], B[1], A[1], B[2], A[2]}; } } else{ // B[0] B[1] B[2] A[1] A[2] tmp = getMedian(B[0], B[1], A[0]); if(tmp == B[0]) return {A[0], B[0], B[1], B[2], A[1], A[2]}; else if(tmp == A[0]) return {B[0], A[0], B[1], B[2], A[1], A[2]}; else return {B[0], B[1], A[0], B[2], A[1], A[2]}; } } void orderCoins(){ vector<int> ans = solve(); int av[6]; for(int i = 0; i < 6; i++) av[i] = ans[i]; answer(av); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:34:15: warning: unused parameter 'T' [-Wunused-parameter]
   34 | void init(int T){
      |           ~~~~^
scales.cpp: In function 'std::vector<int> solve()':
scales.cpp:38:17: warning: control reaches end of non-void function [-Wreturn-type]
   38 |     vector<int> A, B;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...