Submission #961406

#TimeUsernameProblemLanguageResultExecution timeMemory
96140612345678Scales (IOI15_scales)C++17
45.45 / 100
1 ms440 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { return; } int res[6], mn; vector<int> v; void getmin() { vector<int> v2; if (v.size()==3) { res[3]=getLightest(v[0], v[1], v[2]); for (int i=0; i<v.size(); i++) if (v[i]!=res[3]) v2.push_back(v[i]); v=v2; } else if (v.size()==2) { res[4]=getMedian(v[0], v[1], res[0]); for (int i=0; i<v.size(); i++) if (v[i]!=res[4]) v2.push_back(v[i]); v=v2; } else if (v.size()==1) { res[5]=v[0]; } else if (v.size()==6) { mn=getLightest(v[0], v[1], v[2]); mn=getLightest(mn, v[3], v[4]); mn=getLightest(mn, v[5], v[0+(mn==1)]); res[0]=mn; for (int i=0; i<v.size(); i++) if (v[i]!=mn) v2.push_back(v[i]); v=v2; } else if (v.size()==5) { mn=getLightest(v[0], v[1], v[2]); mn=getLightest(mn, v[3], v[4]); res[1]=mn; for (int i=0; i<v.size(); i++) if (v[i]!=mn) v2.push_back(v[i]); v=v2; } else if (v.size()==4) { mn=getLightest(v[0], v[1], v[2]); mn=getLightest(mn, v[3], v[0+(mn==v[0])]); res[2]=mn; for (int i=0; i<v.size(); i++) if (v[i]!=mn) v2.push_back(v[i]); v=v2; } } void orderCoins() { v.clear(); for (int i=1; i<=6; i++) v.push_back(i); for (int i=0; i<6; i++) getmin(); answer(res); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:6:15: warning: unused parameter 'T' [-Wunused-parameter]
    6 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void getmin()':
scales.cpp:19:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         for (int i=0; i<v.size(); i++) if (v[i]!=res[3]) v2.push_back(v[i]);
      |                       ~^~~~~~~~~
scales.cpp:25:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for (int i=0; i<v.size(); i++) if (v[i]!=res[4]) v2.push_back(v[i]);
      |                       ~^~~~~~~~~
scales.cpp:38:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for (int i=0; i<v.size(); i++) if (v[i]!=mn) v2.push_back(v[i]);
      |                       ~^~~~~~~~~
scales.cpp:46:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |         for (int i=0; i<v.size(); i++) if (v[i]!=mn) v2.push_back(v[i]);
      |                       ~^~~~~~~~~
scales.cpp:54:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         for (int i=0; i<v.size(); i++) if (v[i]!=mn) v2.push_back(v[i]);
      |                       ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...