Submission #433329

#TimeUsernameProblemLanguageResultExecution timeMemory
433329pliamScales (IOI15_scales)C++14
0 / 100
1 ms424 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; int known[7]; void init(int T) { /* ... */ } int find_max(){ vector<int> unknown; for(int i=1;i<=6;i++){ if(!known[i]){ unknown.push_back(i); } } int ans1=getHeaviest(unknown[0],unknown[1],unknown[2]); int ans2=getHeaviest(unknown[unknown.size()-1],unknown[unknown.size()-2],unknown[unknown.size()-3]); for(auto x:unknown){ if(x!=ans1&&x!=ans2){ return getHeaviest(x,ans1,ans2); } } } void orderCoins() { /* ... */ int* W = new int[6]; memset(known,0,sizeof(known)); W[5]=find_max(); known[W[5]]=true; W[4]=find_max(); known[W[4]]=true; W[3]=find_max(); known[W[3]]=true; vector<int> last; for(int i=1;i<=6;i++){ if(!known[i]) last.push_back(i); } W[0]=getLightest(last[0],last[1],last[2]); W[1]=getMedian(last[0],last[1],last[2]); W[2]=getHeaviest(last[0],last[1],last[2]); answer(W); }

Compilation message (stderr)

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