Submission #1045508

#TimeUsernameProblemLanguageResultExecution timeMemory
1045508Alihan_8Scales (IOI15_scales)C++17
33.33 / 100
1 ms440 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; #define pb push_back void init(int T) { /* ... */ } void orderCoins() { vector <int> us(7); vector <int> ans; int x = getLightest(1, 2, 3), y = getLightest(4, 5, 6), z = -1; for ( int i = 1; i <= 6; i++ ){ if ( i != x && i != y ){ z = i; } } int t = getLightest(x, y, z); ans.pb(t); us[t] = 1; auto f = [&](){ vector <int> l, r; for ( int i = 1; i <= 6; i++ ){ if ( !us[i] && l.size() < 3 ){ l.pb(i); } } for ( int i = 6; i > 0; i-- ){ if ( !us[i] && r.size() < 3 ){ r.pb(i); } } x = getLightest(l[0], l[1], l[2]); y = getLightest(r[0], r[1], r[2]); if ( x == y ){ ans.pb(x); us[x] = 1; } else{ t = getMedian(ans[0], x, y); ans.pb(t); us[t] = 1; } }; f(), f(); vector <int> r; for ( int i = 1; i <= 6; i++ ){ if ( !us[i] ) r.pb(i); } x = getLightest(r[0], r[1], r[2]); y = getMedian(r[0], r[1], r[2]); ans.pb(x), ans.pb(y); for ( auto &t: r ){ if ( t != x && t != y ) ans.pb(t); } int w[6]; for ( int i = 0; i < 6; i++ ){ w[i] = ans[i]; } answer(w); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:9:15: warning: unused parameter 'T' [-Wunused-parameter]
    9 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:69:14: warning: declaration of 't' shadows a previous local [-Wshadow]
   69 |  for ( auto &t: r ){
      |              ^
scales.cpp:26:6: note: shadowed declaration is here
   26 |  int t = getLightest(x, y, z);
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...