Submission #587086

#TimeUsernameProblemLanguageResultExecution timeMemory
587086keta_tsimakuridzeScales (IOI15_scales)C++14
0 / 100
1 ms468 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } void orderCoins() { vector<int> x; int a = getLightest(1, 2, 3), b = getHeaviest(1, 2, 3); x.push_back(a); x.push_back(6 - a - b); x.push_back(b); // 4 a = getNextLightest(1, 2, 3, 4); if(a != x[0]) { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(x[i] == a) xn.push_back(4); xn.push_back(x[i]); } x = xn; } else { if(getHeaviest(x[1], x[2], 4) == 4) x.push_back(4); else { vector<int> xn; xn.push_back(4); for(int i = 0; i < x.size(); i++) xn.push_back(x[i]); x = xn; } } // 5 a = getNextLightest(x[0], x[1], x[2], 5); if(a != x[0]) { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(x[i] == a) xn.push_back(5); xn.push_back(x[i]); } x = xn; } else { if(getHeaviest(x[1], x[2], 5) == 5) { if(getHeaviest(x[2], x[3], 5) == 5) { x.push_back(5); } else { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(i == 3) xn.push_back(5); else xn.push_back(x[i]); } x = xn; } } else { vector<int> xn; xn.push_back(5); for(int i = 0; i < x.size(); i++) xn.push_back(x[i]); x = xn; } } // 6 a = getNextLightest(x[1], x[2], x[3], 6); if(a != x[1]) { vector<int> xn; for(int i = 0; i < x.size(); i++) { if(x[i] == a) xn.push_back(6); xn.push_back(x[i]); } x = xn; } else if(getHeaviest(x[2], x[3], 6) == 6) { if(getHeaviest(x[3], x[4], 6) == 6) { x.push_back(6); } else { x.push_back(6); swap(x[5], x[4]); } } else { vector<int> xn; xn.push_back(6); for(int i = 0; i < x.size(); i++) xn.push_back(x[i]); x = xn; if(getLightest(x[0], x[1], x[2]) != 6) swap(x[0], x[1]); } // for(int i = 0; i < 6; i++) cout << x[i] << " "; // cout << endl; int W[] = {x[0], x[1], x[2], x[3], x[4], x[5]}; answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
    4 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:16:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |         for(int i = 0; i < x.size(); i++) {
      |                        ~~^~~~~~~~~~
scales.cpp:26:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
      |                            ~~^~~~~~~~~~
scales.cpp:35:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |          for(int i = 0; i < x.size(); i++) {
      |                         ~~^~~~~~~~~~
scales.cpp:46:34: 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 < x.size(); i++) {
      |                                ~~^~~~~~~~~~
scales.cpp:55:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |             for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
      |                            ~~^~~~~~~~~~
scales.cpp:63:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   63 |          for(int i = 0; i < x.size(); i++) {
      |                         ~~^~~~~~~~~~
scales.cpp:78:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |         for(int i = 0; i < x.size(); i++) xn.push_back(x[i]);
      |                        ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...