Submission #604390

#TimeUsernameProblemLanguageResultExecution timeMemory
604390balbitScales (IOI15_scales)C++14
57.12 / 100
1 ms212 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; // #define int ll #define ll long long #define pii pair<int, int> #define f first #define s second #define FOR(i,a,b) for (int i = a; i<b; ++i) #define REP(i,n) FOR(i,0,n) #define REP1(i,n) FOR(i,1,n+1) #define MX(a,b) a = max(a,b) #define MN(a,b) a = min(a,b) #define SZ(x) (int)((x).size()) #define ALL(x) (x).begin(), (x).end() #define pb push_back #ifdef BALBIT #define bug(...) cerr<<"#"<<__LINE__<<":"<<#__VA_ARGS__<<"- ", _do(__VA_ARGS__) template<typename T> void _do(T && x) {cerr<<x<<endl;} template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);} #else #define bug(...) #define endl '\n' #endif void init(int T) { } void orderCoins() { /* ... */ int A = getLightest(1,2,3); int C = getHeaviest(1,2,3); int B = 1^2^3^A^C; int D = getLightest(4,5,6); int F = getHeaviest(4,5,6); int E = 4^5^6^D^F; vector<int>tmp = {A,B,C}; vector<int>done; vector<int>mash; vector<int>haha = {D,E,F}; REP(i, SZ(haha)) { int x = haha[i]; if (SZ(tmp) == 0) { done.pb(x); continue; } if(SZ(tmp) == 1) { int hm = getMedian(done.back(), tmp[0], x); if (hm == done.back()) assert(0); if (hm == tmp[0]) { done.pb(tmp[0]); done.pb(x); }else{ done.pb(x); done.pb(tmp[0]); } tmp.clear(); continue; } int hm = getMedian(tmp[0],tmp[1],x); if (hm == tmp[0]) { done.pb(x); goto over; } else if (hm == x) { done.pb(tmp[0]); done.pb(x); tmp.erase(tmp.begin()); goto over; }else{ done.pb(tmp[0]); done.pb(tmp[1]); tmp.erase(tmp.begin()); tmp.erase(tmp.begin()); for(int j = i; j<SZ(haha); ++j) { mash.pb(haha[j]); } break; } over:; } if (SZ(mash) > 0) { if(SZ(tmp) == 0) { for(int x : mash) { done.pb(x); } }else{ assert(C == tmp[0]); int cord = -1; if(SZ(mash) == 3) { int yar = getMedian(mash[0], mash[1], C); if (yar == mash[0]) { cord = 0; }else if (yar == C) cord = 1; else { int yoo = getMedian(mash[1], mash[2], C); if(yoo == mash[2]) cord = 3; else cord = 2; } }else if (SZ(mash) == 2) { int yar = getMedian(mash[0], mash[1], C); if (yar == mash[0]) { cord = 0; }else if (yar == C) cord = 1; else { cord = 2; } }else{ int yar = getMedian(done.back(), mash[0], C); if(yar == mash[0]) { cord = 1; }else cord = 0; } REP(i, SZ(mash)+1) { if (i == cord)done.pb(C); if (i <SZ(mash)) done.pb(mash[i]); } } }else{ for(int e :tmp) done.pb(e); } int yay[6]; REP(i,6)yay[i]=done[i]; REP(i,6)bug(i, yay[i]); answer(yay); }

Compilation message (stderr)

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