Submission #120193

#TimeUsernameProblemLanguageResultExecution timeMemory
120193pavelScales (IOI15_scales)C++14
38.46 / 100
3 ms384 KiB
#include <vector> #include <cstdio> #include "scales.h" using namespace std; void init(int T) { /* ... */ } void orderCoins() { int W[] = {1, 2, 3, 4, 5, 6}; vector<vector<int>> v; for(int i=1;i<=6;++i) v.push_back(vector<int>(1, i)); vector<int> sol; while(true){ if(v.size()==3){ int a = getLightest(v[0].back(), v[1].back(), v[2].back()); int b = getMedian(v[0].back(), v[1].back(), v[2].back()); for(int i=0;i<3;++i){ if(a==v[i].back()){ sol.insert(sol.end(), v[i].begin(), v[i].end()); } } for(int i=0;i<3;++i){ if(b==v[i].back()){ sol.insert(sol.end(), v[i].begin(), v[i].end()); } } for(int i=0;i<3;++i){ if(v[i].back()!=a && v[i].back()!=b){ sol.insert(sol.end(), v[i].begin(), v[i].end()); } } break; }else{ int med = getMedian(v[0].back(), v[1].back(), v[2].back()); vector<vector<int>> nm; vector<int> medv; for(auto i:v){ if(i.back()!=med){ nm.push_back(i); }else{ medv=i; } } int y = getNextLightest(nm[0].back(), nm[1].back(), nm[2].back(), med); if(v.size()>4){ if(y==nm[nm.size()-2].back()) y = getNextLightest(y, nm[nm.size()-1].back(), nm[0].back(), med); else y = getNextLightest(y, nm[nm.size()-1].back(), nm[nm.size()-2].back(), med); } vector<vector<int>> nxtv; for(auto i:nm){ if(i.back()!=y){ nxtv.push_back(i); }else{ medv.insert(medv.end(), i.begin(), i.end()); nxtv.push_back(medv); } } v=nxtv; } } for(int i=0;i<6;++i) W[i]=sol[i]; answer(W); }

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...