Submission #802039

#TimeUsernameProblemLanguageResultExecution timeMemory
802039KhizriScales (IOI15_scales)C++17
45.45 / 100
1 ms304 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; #define pb push_back void init(int T) { /* ... */ } void orderCoins() { int mx=getHeaviest(1,2,3); int mx2=getHeaviest(4,5,6); set<int>st{{1,2,3,4,5,6}}; st.erase(mx); st.erase(mx2); int x=*st.begin(); int largest=getHeaviest(mx,mx2,x); int mn=getLightest(1,2,3); int mn2=getLightest(4,5,6); int m=6-mx-mn; int m2=15-mx2-mn2; deque<int>l={mn,m,mx}; deque<int>r={mn2,m2,mx2}; vector<int>ans; while(l.size()&&r.size()){ int a=l[0],b=r[0]; if(a==largest){ while(r.size()){ ans.pb(r[0]); r.pop_front(); } ans.pb(a); l.pop_front(); } else if(b==largest){ while(l.size()){ ans.pb(l[0]); l.pop_front(); } ans.pb(b); r.pop_front(); } else{ int x=getLightest(a,b,largest); ans.pb(x); if(x==a){ l.pop_front(); } else{ r.pop_front(); } } } while(l.size()){ ans.pb(l[0]); l.pop_front(); } while(r.size()){ ans.pb(r[0]); r.pop_front(); } int W[]={0,0,0,0,0,0}; for(int i=0;i<ans.size();i++){ W[i]=ans[i]; } answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
    5 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:43:17: warning: declaration of 'x' shadows a previous local [-Wshadow]
   43 |             int x=getLightest(a,b,largest);
      |                 ^
scales.cpp:15:9: note: shadowed declaration is here
   15 |     int x=*st.begin();
      |         ^
scales.cpp:62:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |     for(int i=0;i<ans.size();i++){
      |                 ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...